Confused about "Apply root motion" in the animator component.

Currently, my scene has a cube with a jump animation. I attached the player controller script to the cube and was confused as to why I can’t move the cube with the animator component active. The jump animation played just fine, but the player movement wasn’t working at all. I checked the “Apply root motion” checkbox and now I can move my cube with the arrow keys and play the jump animation when I hit the spacebar. My question is, what exactly did root motion do to fix my player not moving? I also noticed that when the player now jumps, he moves up relative to his new position instead of teleporting back to the initial position and jumping from there. I assume root motion also has something to do with that. Thanks in advance!

1 Like

Animations set things to a specific value. For example, if a movement animation might start the position.x at 0 and move it to 1 over the course of the animation, but then when the animation loops it will set it to 0 again and teleport back to the start.

Root motion changes any movement that would normally be applied to the root object to be additive instead. So if your position.x is at 4 and you play that animation it will it will add the motion so it moves towards 5 then 6 then 7 and not jump back to the starting value when it loops.

14 Likes

Oh my this is probably the clearest explanation I ever came across. Thanks a ton!