Rotate bone while animating

Hey there,

I’ve been struggling to rotate my model’s bones while the same model is running an animation.

The reason why is I want to apply a running animation, and at the same time rotate the lower body towards the target position, but not the upper body.

While debugging, I was able to rotate the legs and run the animation, both separately, but not together. The animation always takes priority over the rotation:

Running:
run

Rotating:
rotate

Running + rotating:
run

It’s my first experience with animations, so I’m not sure how that would work. If anybody has information on paths that I could follow to achieve that, it’ll be very much appreciated :slight_smile:

Thanks in advance!

Maybe same here
https://threejs.org/examples/?q=anima#webgl_animation_skinning_additive_blending

You need to apply your own transformation after updating the mixer, there is no need for additive animations in such case necessarily, especially for things that will depend on dynamic factors like speed, or other forces.

Just as you would procedurally FK control a head for looking, i also use this for the same reason with multiple bones, and further for mixing different animations on separated skeleton parts which is more efficient than using additive composed animations for every possible combination.

Here holding items, mixing with all other actions like walking, running, jumping etc, and blending the different skeleton sectors with other animations like drinking a fresh Conka Cola. Which essentially also is for doing other things than the legs, however with additive animations you can actually mix different types of animations to have a different style, like regular walking with being wounded and walking in a limp.

The only thing you need to make sure with additional FK is managing the strength of your transformations yourself to fade them in and out.


Was linear at this point, i would also recommend to use cubic blending as transition factor, the more different you transformation from the original is the more abrupt it can look if linear.

Thanks for the replies!

@Chaser_Code: Isn’t that mixing 2 animations? In my case, the second thing is just a rotation, not an animation, so I’m not sure how I’d blend those. But that gave me an idea, I could make an animation that rotates the hip from 1 to 359 degrees and choose which frame from it I want to blend in. Thanks!

@Fyrestar: Thanks for the tips! I earlier tried applying my rotation after updating the mixer, but that didn’t do much. However, after your response, I realized it’s because the animation is resetting the rotation every frame, so it isn’t rotating:
image

After switching delta to clock.getElapsedTime() it now works :smiley:

fixed

1 Like

Yes the mixer only cares for blending the action clips, that’s what i mean with managing the transformations yourself outside, especially to smoothly blend in and out what you add, preventing to make it flip instantly back.

@Fyrestar Would you happen to know what’s going on here?
It’s flickering every time the animation goes from the end to the start, while rotating:
(don’t worry about the arms, they’re like that because I’ll add a different animation to them later)
bug2

Here’s the code that plays the animation and adds the rotation:

I suppose you’re still just progressively rotating it, i recommend using a proxy matrix (or Object3D for easier usage) you will apply your custom transformations to without any interruption, and from there apply to the target bone, here you can fade in/out your transformation to the bone.

Otherwise you likely run into the mixer/keyframes working between 360 or other conflicting issues like the animation actually having a keyframe on that bone in the loop that will reset it, you can also take over bones with keyframes if you explicitly override them. Generally what you apply/add is more something absolute (but relative to the parent) like turning your proxy pelvis 60 degree, and this is what you apply to the bone.

Just manage the custom transformations with proxies, not directly on the model, you can still also consider it’s current state of the animation every frame and do some fancy mixing, or the parent, what already goes more into IK (inverse kinematics)