- Joined
- Jan 14, 2008
- Messages
- 9,203
- Reaction score
- 1,548
- Points
- 203
- Location
- VA
- Website
- alteaaerospace.com
- Preferred Pronouns
- he/him
I've been digging into adding a hack to the XR vessels to work around this Orbiter core bug, but I'm seeing some odd behavior with DefSetStateEx, and now I'm wondering if I can even use that method to do what I want.
My goal with this hack is to cancel out any vessel motion relative to the surface of the body on which it's landed, but I can't even get that far. Right now I have added this code as a test to my ParkingBrakePreStep, which should not change the ship's velocity at all, but invoking DefSetStateEx even without changing any fields in it causes the vessel to spin wildly while landed:
I also looked into using VESSEL::SetElements, but that won't work because the docs say:
I am already successfully using VESSEL:
efSetState to spawn or move cargo vessels, but it seems that when I use it on a landed vessel, chaos ensues. Any advice would be much appreciated -- I'm stuck on this one.
My goal with this hack is to cancel out any vessel motion relative to the surface of the body on which it's landed, but I can't even get that far. Right now I have added this code as a test to my ParkingBrakePreStep, which should not change the ship's velocity at all, but invoking DefSetStateEx even without changing any fields in it causes the vessel to spin wildly while landed:
Code:
VESSELSTATUS2 status;
// Initialize entire structure to zero before invoking the read from the core since the core does not initialize all the fields in GetStatusEx, which can crash DefSetStateEx
memset(&status, 0, sizeof(status));
status.version = 2; // retrieve version 2 = VESSELSTATUS2
GetXR1().GetStatusEx(&status);
// PROBLEM: invoking DefSetStateEx even with no changes causes the vessel to spin wildly while landed
GetXR1().DefSetStateEx(&status);
I also looked into using VESSEL::SetElements, but that won't work because the docs say:
VESSEL::SetElements said:Calling SetElements will always put a vessel in freeflight mode, even if it had been landed before.
I am already successfully using VESSEL: