0
\$\begingroup\$

I downloaded some animations with root motion from Mixamo and the corresponding character model.

After created an animator with those animations and added it to the character game object, the root motion was causing the transform to move around, which was not supposed to happen.

I tried to uncheck "Apply Root Motion", and set "Motion - Root Motion Node" to "None", but neither of them worked.

The only thing that worked is checking "Loop Time - Loop Pose", but it doesn't make much sense to mess with root motion, someone even proposed it shouldn't disable root motion.

So, how to disable animation root motion?

Also I'm confused, is root motion optional? Must I get animations without root motion if it's not needed?

\$\endgroup\$
0
\$\begingroup\$

This page explains how Unity root motion animation works: https://docs.unity3d.com/Manual/RootMotion.html

To understand the problem, read ahead or skip to "how to fix" in end the for solutions:

Body root transform/node can be thought as "reference point" of skeleton relative to 3d space where it and it's animation exists. In Unity humanoid rigs, it is the only world space node for skeleton according to Unity manual (see link above).

In animation software animations are usually done either "in-place" or by moving characters in scene space. It might be easier to animate a run loop "threadmill" style, so that legs and arms swing yet hips stay on place (character does not translate in 3d scene space). On the other hand, it might be easier to animate a jump and roll over fence so that character moves in 3d scene space, this way feet and hands can be firmly planted on key moments.

According to Unity manual, Unity's implementation of root motion concept works like this: Root motion is calculated from body transform node in run-time. In animation clip, body transform might move relative to animation scene "world space", but what Unity does, it computes this offset every frame, and then applies it to game object as movement instead, and what they don't say - removes it from root node. By toggling "Root Transform Position (XZ), Bake into pose on, you'll see that this process is reversed, and you'll see your character sprint away from animation clip origin, if your animation clip skeleton is animated moving in scene space, that is. When you toggle bake into pose off, you see that world grid starts to travel under character, meaning that Unity has removed the root x and y movement (transform/GameObject is moving).

(Reasons for this are understandable but Unity explanation for this is not very clear. For example, Unreal engine explains it's own implementation quite clearly: https://docs.unrealengine.com/en-US/Engine/Animation/RootMotion)

Mixamo animations might be animated / captured this way moving in 3d space, and will have skeleton root moving away from origin. But if this root node movement exists, it results in unity root motion values, which in turn will be moving GameObject in scene. If there is movement in animation clip character's hips (whatever the topmost joint is), Unity will see it as offset, and will move your character Transform/GameObject in scene. There are no check boxes to remove x and z animation from character root node IIRC.

How to fix:

a. Recreate animation export in Mixamo if possible, so that character is animated in-place (mentioned already in comments).

b. Remove root offset movement in Unity. Make a copy of animation clip (so that you can change it), open it in Animation Window then find the skeleton root node, select and delete keyframes for translation animation from both x- and z-axis, and leave y-axis movement untouched.

c. Take animation back into animation software (Maya) or motion editing/authoring software (Motion Builder) and modify the animation clip to remove the root animation.

\$\endgroup\$
  • \$\begingroup\$ Thanks for such a detailed explanation, though some points still seem vague to me but I'll take them by now, could understand them better after participating some real animation works, thanks :) \$\endgroup\$ – Arxz Aug 17 '18 at 14:58
1
\$\begingroup\$

In the inspector for the animation file (e.g walking.fbx), in the Animation pane, if you check both "Loop time" and "Loop Pose" then the animation will be in place.

Another technique is in the animation window, the base animation will be read-only, but if you copy all the properties into a new animation and remove the Hip motion you should be in place.

Also, and maybe this is more adapted to your particular issue. If you set the rig type to humanoid, then you will be able to "Bake into pose" XZ, Y and rotation. Which will deactivate root motion for the particular parameter.

\$\endgroup\$
0
\$\begingroup\$

Assuming there is a humanoid animation: copy all the keyframes (Ctrl+a,Ctrl+c), create a new animation clip (Create > Animation), paste the keyframes, find "Animator.RootT" and expand it. Assuming the model moves in forward Z, right click on "RootT.Z" and click "Remove property."

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.