Setting a vessel's state vectors

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,325
Reaction score
31
Points
123
Location
Sydney, Australia
I've had a long day so forgive me if I missed this in the manual: How can I set a vessel's state vectors directly? I know there is SetElements but I already have calculated what the state vectors should be and I would rather avoid using the extra CPU cycles converting them to state vectors.

Background: I am writing a scenario wizard for the Ananke project and I want to "teleport" the payload vessel to the correct position, velocity and time so Ananke can throw it to the moon.
 
vessel->DefSetStateEx(&vs2);

VESSELSTATUS2 has rpos and rvel VECTOR3 members, which AFAIR are the state vectors.
 
vessel->DefSetStateEx(&vs2);

VESSELSTATUS2 has rpos and rvel VECTOR3 members, which AFAIR are the state vectors.
Thanks! I tried that one but I was getting a CTD so I thought perhaps it wasn't valid outside of initial vessel creation. I guess I have another bug to track down. Where's that fly swat? :P
 
After you declare the VESSELSTATUS2 struct, make sure you have
Code:
memset(&vs, 0, sizeof(vs));
This prevents incorrect data from being passed when you call DefSetStateEx
 
Back
Top