API Question How to make wheel animations

Majid

Active member
Joined
Oct 31, 2014
Messages
156
Reaction score
28
Points
43
Code:
static MGROUP_ROTATE frontRightSpinForward(0, frontRightGroups, 1, axeRightFront, _V(1, 0, 0), 360 * RAD);

static MGROUP_ROTATE frontRightRight(0, frontRightGroups, 1, axeRightFront, _V(0, 1, 0), 75 * RAD);

I have 2 animations like above. 1 animation is to make the wheel spin forward, the other is to turn the wheel right. How do I define the animations such that the wheel can be turned and spin forward at the same time?

The animations work individually. However when I propagate the spin animation with SetAnimation and turn right the animation gets messed up and the axis of rotation are not right.
 
in clbkPreStep

Code:
auto anim_state = GetAnimation(front_right_spin_forward_anim);
anim_state += simdt * 0.1;
if (anim_state > 1) anim_state = 0;
SetAnimation(front_right_spin_forward_anim, anim_state);

in clbkSetClassCaps immediately after defining the animations:

Code:
SetAnimation(front_right_right_anim, 0.1);
 
Right off hand. The issue seems to be 2 animations on the same groups
 
Right off hand. The issue seems to be 2 animations on the same groups

Sorry, I am very unfamiliar with animations. The wheel is 1 mesh group. How do I spin it and rotate it without defining 2 animations each referencing this group? I know add-ons where the wheels are animated to spin and turn/rotate with the vessel, and that's what I want to do here.


Kind of like your LER, where the wheels spin and turn.
 
I believe I had the axle as a parent that turn as to steer and the wheel as a child.
 
Got it

Code:
frontRightRight = new MGROUP_ROTATE(0, frontRightGroups, 0, axeRightFront, _V(0, 1, 0), 75 * RAD);
		parent = AddAnimationComponent(anim_steering, -1, 1, frontRightRight);

		frontRightSpinForward = new MGROUP_ROTATE(0, frontRightGroups, 1, axeRightFront, _V(1, 0, 0), 360 * RAD);

Had to define the animations like that and make the MGROUP_ROTATE instances class variables instead of static.

For more info, look at Orbitersdk/doc/API_Guide.pdf pg 22-23.
 
Back
Top