MecAnim Root Motion - How To Prevent It

Hi folks,

NOTE! I solved my own problem as I was nearly finished writing up this question. I’m going to post the question anyway (with my answer at the bottom) in case anyone else comes across this. I’m officially embarrassed once you see what the solution actually is.

I’m just getting started using MecAnim so there’s plenty of learning to be done. It’s absolutely amazing but I’ve hit a problem I can’t seem to get around, and I assume it’s just because I’m doing things incorrectly.

We have a scene where we want our character to be idling in a different position within the scene randomly when you enter the scene. The animations have his position in the scene built into them. So if I set an animation state within the Animator window to default that has him, say, sitting at a desk in the room, he’ll be there. It works great when I default to that.

The problem comes in when I attempt to have a starting default node that’s empty, with a series of transitions that lead to actual animations. I have a parameter called DesiredState, which I default to -1 within the animator window. When my script starts, I randomly set it to a valid value, which takes us from the Default State (which is just an empty state with no animations) to the appropriate idle. He’ll play the idle animation, but he seems to only get ‘some’ of the root motion, and I don’t fully understand why.

My tree is looks like this, where each Transition arrow is just checking if the desired state is whatever we want it to be (for instance, laying down you can see I use [ 2 ] so a value of 2 would transition us to that state).

The STARTING STATE is my default, as you can see…and if I set ‘[ 2 ] Laying Down’ to be default, he’ll be there fine. But like I said, if I try to transition to that state, he’ll be playing the laying down animation, and he’ll correctly be up on the Y axis (the cot he sleeps on is above on a platform) but his X/Y position are wrong.

Specifically, when I go into this scene and see he’s wrong, all I need to do is zero out his position. The X and Z actually get values, which are wrong! I want him to be a world origin because we place him within the animation. The Y value is 0, which is what it should be, because the animation places him up high on the cot, but the X and Z are getting values and they shouldn’t be.

One of my animations looks like this:

I’m going to skip the wrap-up (this is when I discovered the solution) and simply mention what I missed so other people can save themselves a few hours of hair pulling.

MecAnim offers a ton of power and flexibility, and while you might think it all exists within the Animator tree and the animation clips themselves, there is ONE option I missed that sits on the Animator component itself. Since we were positioning our character through the animations, ultimately, we didn’t want Root Motion at all. Well, there’s a checkbox for ‘Apply Root Motion’ right on the component. If you don’t want root motion, uncheck that and keep a full head of hair!

Hope this doesn’t waste anyone’s time reading it since the solution is super dumb and likely something you all already know. But if it saves 1 person a headache, then I’m glad I’m posting.

Good luck everyone! MecAnim is amazing, enjoy it! :slight_smile:


“Well, there’s a checkbox for ‘Apply Root Motion’ right on the component. If you don’t want root motion, uncheck that and keep a full head of hair!”

What is root motion doing? I mean what is root motion.