7
\$\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\$
2

6 Answers 6

5
\$\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\$
2
  • \$\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
    Commented Aug 17, 2018 at 14:58
  • \$\begingroup\$ 1st option no longer works since Mixamo removed the "in-place" option. \$\endgroup\$
    – glenneroo
    Commented Sep 5, 2021 at 12:54
6
\$\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\$
1
  • 2
    \$\begingroup\$ This solution worked for me. Specifically, checking the "Bake into Pose" and "Loop Pose" boxes. I did not have to reimport, mess with keyframes, or go into blender. \$\endgroup\$ Commented Mar 26, 2021 at 3:09
1
\$\begingroup\$

Other than turning off root motion in the animator, I also loop the animation and the pose too. Here is a video on how to do that.

\$\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\$
0
\$\begingroup\$

When importing a Maximo I found that not including an animation alleviates the Unity hanging crouch default position in game play or animation preview. The avatar selection in the inspector animator must be cleared also.

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

This is an old question, but it's still relevant and one of the top result when searching for a solution and, yet, the main solution is not yet in any so here you go...

The "Root Transform" check boxes in any animation are used to apply the movement of the root object to the the in-game character transform. If it's checked ON, it allows the root object translation (movements) to be copied onto the object's transform in an additive while if it's OFF, the animation motion will be added to the object's transform, but will also include the part where it loop back (for example, with a walk animation with Root Motion, it will looks like the character is rubber-banding back to its start position once the animation is done.)

"Root Transform" is useful in cases, for example, where you want to customize the movement of the character based on its animation without coding all the variances in speed and direction. (For example, if you want the character to step forward during an attack or if you want a character to move at the representative speed of its steps and not just moon-walking.)

Outside of Unity, there are a lot of ways of handling the issue (some are easy and some are time-consuming), but Unity itself has a built-in way that is relatively straight forward.

To do it directly in Unity (for example, with animation you got from some assets purchased from the Asset Store), go to the FBX file, in the Unity Project menu, that contains the animation(s) you need. (Note: The animations HAS to be applied to the "Animation" tab of the FBX first.) Open the FBX file content by clicking on the arrow right or left to it (depending on the type of display). You should see each animation set in the FBX (the icon is a cyan triangle with some white or black lines on its left) Select all the animation, copy (CTRL+C) and paste (CTRL+V) them outside of the FBX file. Unity will generate animation files based on the animation settings set in the FBX.

Those animation files that get copied and pasted can be edited in the "Animation" menu in Unity. You can remove the root motion from those file by looking up, in the "Animation" menu for the Animator.Root.T line of keyframe. Each animated bones in the animation will have 2 lines of keys. One is ending with "T" which is the Transform (movement) and one is the "Q" which is the Quaternion (rotation). You might think of just deleting them both, but remember that it will remove ALL position and rotation references. If you got a skill that turn the character 360 degrees for an attack, that turn will most likely disappears if you remove the "Root Q" keys. At the same time, if you just remove the "Root T" keys, the character might end up being offset from the proper position.

So, the trick is to uncheck the Root Transform Rotation and Position(Y) and (XZ), which can be done in the animation file you copied and pasted, go to the "Root Q" and "Root T" line of animation keys in the Animation menu. If you don't need any rotation (like for a walking/run that is straight forward), you can deleted the "Root Q" line of keys. (you can delete a whole line just by clicking on the white dot right of the "Root Q" and select "Remove Property".) For the "Root T", line, it needs a bit more subtleties: You got to open the drop-down (arrow right of the animation key line name) which will reveal the 3D movements axes (X,Y,Z) of the animation root. You can delete the property (as previously mentioned) for the X and Z unless you need them (for specific animations) and if you don't need any of the Y keys, you can just delete all keys of that line (do NOT delete the property), except for the first key. This can easily be done by selecting the 2nd key, then while holding shift, click on the last key and then press Delete. If There's only 1 key (the first one), the animation will not have root motion, but it will still have its proper "default" position.

If you delete the whole line of keys on "Root T.y", there's a chance your character will be positioned with its pelvis position as its "origin" instead of its root position, resulting with your character being quite lower than anticipated visually.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .