Error "ShiftCG()" causes CTD on scenario start

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,868
Reaction score
4
Points
0
Location
San Diego
I've been trying to get my Lunar Lander to a state where I wont be embarassed to share it and have hit a snag.

If I load a scenario, quit, and then try to load "(Current state)" Orbiter crashes to desktop upon scenario start.

This only happens after seperating from the descent stage and I've narrowed it down to the following line...

Code:
void Spider::clbkPostCreation ()
{
  if (STATUS==Ascent) // If the scenario spawns us in ascent configuration we need to aplly the changes that would normally occur durring stage seperation.
  {
    DelMesh(mesh_DS); // Delete descent stage mesh
    [COLOR="Red"]ShiftCG(LM_AscentOFFSET);[/COLOR] //Shift center of gravity *Triggering CTD?*
    ApplyAscentConfig(); // Apply vessel parameters
  }
  ...

With the red line commented out the scenario loads normaly. With it in there I CTD.

Does anyone know why this might be happening or have any ideas for a work-around?
 
Last edited:
I had this problem a while ago. You have to add it in the update function with a boolean to control whether it's going to be set or not.
 
Could you post an example?
 
Nevermind, I figured it out.

Thank you. :tiphat:

---------- Post added at 05:30 AM ---------- Previous post was at 04:57 AM ----------

or maybe not
 
Sorry, got distracted after being invited to a game of Civ V...

I'll grab it ASAP.

---------- Post added at 12:43 AM ---------- Previous post was at 12:41 AM ----------

Here's the basic example that I used

Code:
void ReusableCrewVehicle::clbkPostStep (double simt, double simdt, double mjd)
{
	if (!delayedInit)
	{
		if (SMstatus != 0)
		{
			ShiftCG(RCV_CG_WHOLE);
		}
		delayedInit = true;
	}
}
 
Thanks again.
 
Ran into that too. Orbiter 2010 crashes if you set cog in PostCreation (Orbiter 2006 didn't), so yeah, easiest fix is to execute the shift in the very first PreStep. I see Silisiko does it in the first PostStep, I guess it doesn't make much difference under most circumstances, really. But doing it in PreStep ensures that it will still be executed before any other calculations are applied to the vessel, while PostStep is only called after the first frame has already been rendered.

As I said, probably not much of an issue, but save is save...
 
Alright, I've got it working for real this time.

Thanks Again.
 
Back
Top