Error "ShiftCG()" causes CTD on scenario start

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
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:

NovaSilisko

The Siliskoiest of Siliskos
Addon Developer
Joined
Jan 11, 2012
Messages
577
Reaction score
0
Points
0
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.
 

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
Points
0
Location
San Diego
Could you post an example?
 

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
Points
0
Location
San Diego
Nevermind, I figured it out.

Thank you. :tiphat:

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

or maybe not
 

NovaSilisko

The Siliskoiest of Siliskos
Addon Developer
Joined
Jan 11, 2012
Messages
577
Reaction score
0
Points
0
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;
	}
}
 

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
Points
0
Location
San Diego
Thanks again.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,862
Reaction score
2,125
Points
203
Location
between the planets
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...
 

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
Points
0
Location
San Diego
Alright, I've got it working for real this time.

Thanks Again.
 
Top