Ok I know this is a bit of a necro-post but I've encountered a new issue.
I was working on animating my landing gear and it seems that my prior solution for defining a animation in an array does not tolerate multiple mesh groups. I did not encounter this before simply because each switch is comprise of only a single group (in the case of the needles a single triangle)
My landing gear are a bit more complex, here is the function...
Running the animation in Orbiter causes a CTD.
I'm pretty sure it's the "LegGroups" array that is the culprit as when I replace it with a fixed value I don't get the CTD.
My as it stands I''ve managed to get the whole animation sequence to work simply by dropping the "for (int i = 0; i < 4; i++)" manually defining each block of animations in turn but I'd like to why that works and my initial approach didn't.
The latter approach is also rather messy to look at.
I was working on animating my landing gear and it seems that my prior solution for defining a animation in an array does not tolerate multiple mesh groups. I did not encounter this before simply because each switch is comprise of only a single group (in the case of the needles a single triangle)
My landing gear are a bit more complex, here is the function...
Code:
static UINT LegGroups[4][3] = {
{DS_GRP_LandingFoot_FWD, DS_GRP_ShockStrut_FWD, DS_GRP_PrimaryStrut_FWD}, {DS_GRP_LandingFoot_AFT, DS_GRP_ShockStrut_AFT, DS_GRP_PrimaryStrut_AFT},
{DS_GRP_LandingFoot_PORT, DS_GRP_ShockStrut_PORT, DS_GRP_PrimaryStrut_PORT}, {DS_GRP_LandingFoot_STBD, DS_GRP_ShockStrut_STBD, DS_GRP_PrimaryStrut_STBD} };
static UINT StrutGroup[4], DownlockGroup[4];
anim_Gear = CreateAnimation (1.0);
for (int i = 0; i < 4; i++)
{
StrutGroup[i] = DS_GRP_SecondaryStruts_AFT + i;
DownlockGroup[i] = DS_GRP_Downlock_AFT + i;
Leg[i] = new MGROUP_ROTATE ( 2, &LegGroups[i][3], 3, LEM_LegPivot[i],LEM_LG_Axis[i], (float) 45*RAD);
Strut[i] = new MGROUP_ROTATE ( 2, &StrutGroup[i], 1, LEM_StrutPivot[i], LEM_LG_Axis[i], (float)-63*RAD);
Downlock[i] = new MGROUP_ROTATE ( 2, &DownlockGroup[i], 1, LEM_DownlockPivot[i], LEM_LG_Axis[i], (float) 150*RAD);
ah_Leg[i] = AddAnimationComponent (anim_Gear, 0, 1, Leg[i]);
ah_Strut[i] = AddAnimationComponent (anim_Gear, 0, 1, Strut[i], ah_Leg[i]);
AddAnimationComponent (anim_Gear, 0, 1, Downlock[i], ah_Strut[i]);
}
Running the animation in Orbiter causes a CTD.
I'm pretty sure it's the "LegGroups" array that is the culprit as when I replace it with a fixed value I don't get the CTD.
My as it stands I''ve managed to get the whole animation sequence to work simply by dropping the "for (int i = 0; i < 4; i++)" manually defining each block of animations in turn but I'd like to why that works and my initial approach didn't.
The latter approach is also rather messy to look at.