I have got a parent child that compiles ok. but doesn't do what I want.
I want a turret to rotate and then the gun which is part of the turret to elevate.
I want a turret to rotate and then the gun which is part of the turret to elevate.
Code:
ANIMATIONCOMPONENT_HANDLE parent;
static UINT EGrp20[4] = {0,15,50,58};
static UINT EGrp21[3] = {0,15,58};
static MGROUP_ROTATE TURRET (0,EGrp20, 4, _V(0,1.716,-1.701), _V(0,1,0), (float)(360*RAD));
GUN = new MGROUP_ROTATE(0,EGrp21, 3, _V(0,1.716,-1.701), _V(0,0,1), (float)(90*RAD));
anim_TURRET = CreateAnimation (0.0);
parent = AddAnimationComponent (anim_TURRET, 0, 1, &TURRET);
anim_gun = CreateAnimation (0.0);
AddAnimationComponent (anim_TURRET, 0, 1, GUN, parent);
...
//turrent
double db = simdt * LIFT_SPEED;
if (TURRENT_proc > 1) TURRENT_proc = (TURRENT_proc - 1);
else if (TURRENT_proc < 0) TURRENT_proc = (TURRENT_proc + 1);
if (TURRENT_check == 1)TURRENT_proc = (TURRENT_proc + db);
else if (TURRENT_check == 2)TURRENT_proc = (TURRENT_proc - db);
else if (TURRENT_check == 0)TURRENT_proc = TURRENT_proc;
SetAnimation (anim_TURRET, TURRENT_proc);
}
{
//GUN
double dc = simdt * LIFT_SPEED;
if (GUN_proc > 1) GUN_proc = (GUN_proc - 1);
else if (GUN_proc < 0) GUN_proc = (GUN_proc + 1);
if (GUN_check == 1)GUN_proc = (GUN_proc + dc);
else if (GUN_check == 2)GUN_proc = (GUN_proc - dc);
else if (GUN_check == 0)GUN_proc = GUN_proc;
SetAnimation (anim_gun, GUN_proc);
}