# API QuestionHow to make wheel animations

#### Majid

##### Active member
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.

#### gattispilot

What does your set animation look like

#### Majid

##### Active member
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);

#### gattispilot

Right off hand. The issue seems to be 2 animations on the same groups

#### Majid

##### Active member
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.

#### gattispilot

I believe I had the axle as a parent that turn as to steer and the wheel as a child.

#### Majid

##### Active member
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.

SDK Question robotic arm tip issue
Replies
0
Views
536
Replies
0
Views
210
Replies
3
Views
712
Replies
8
Views
1K
Replies
3
Views
2K