Problem deallocate memory and ShiftCG = CTD?

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,891
Reaction score
2,141
Points
203
Location
between the planets
My vessel has a call to ShiftCG in clbkPostCreation. When starting Orbiter for the first time from the launchpad, this works without problems. If Orbiter is set to deallocate memory on shutdown, the second time Orbiter is started from the launchpad (without completely quitting first), this results in an access violation in orbiter.exe. Does anybody have an idea what could be the cause of this?
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,891
Reaction score
2,141
Points
203
Location
between the planets
This is a bit of a problem, as IMS pretty much puts the vessel together from different parts at creation, and then calculates the CG accordingly. I guess it should work to just do it in the first frame, though...

EDIT: moving it to LoadStateEx isn't a possibility, as the new center of gravity isn't yet calculated. Moving it to the first frame makes the shift actually visible in camera view. I assume that this is because the camera is focused on the COG... I guess that's not much of a backdraw, then. Just one question: Is it the cog that shifts so slowly, or is it only the camera following it? If it's the cog itself, this could cause trouble with scenarios saved during maneuvers...
 
Last edited:

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
Just one question: Is it the cog that shifts so slowly, or is it only the camera following it?
The CoG is moved immediately, just the movement of the camera is smoothed.
 

Woodylepic

New member
Joined
Dec 29, 2009
Messages
71
Reaction score
0
Points
0
My vessel has a call to ShiftCG in clbkPostCreation. When starting Orbiter for the first time from the launchpad, this works without problems. If Orbiter is set to deallocate memory on shutdown, the second time Orbiter is started from the launchpad (without completely quitting first), this results in an access violation in orbiter.exe. Does anybody have an idea what could be the cause of this?

I think that if you initialise the cog in a
separate SetClassCaps (cfg);
like this it will not crash ? see the example above.


void lc36_launchpad::clbkSetClassCaps (FILEHANDLE cfg)
{
SetClassCaps (cfg);
}


void lc36_launchpad::SetClassCaps (FILEHANDLE cfg)
{
ShiftCG (_V(-0.005080002,-0.096520030,7.464+3.526));

{

 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,891
Reaction score
2,141
Points
203
Location
between the planets
It might work, but I do not know the center of gravity at that time, as it is dynamic ;)
 
Top