Search Unity

What does ApplyBuiltInRootMotion do?

Discussion in 'Animation' started by Baste, Nov 20, 2019.

  1. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    I was getting some pretty horrible results by doing this:

    Code (csharp):
    1. void OnAnimatorMove() {
    2.     animator.ApplyBuildInRootMotion();
    3. }
    The movement was stuttery, and moving the y-position of the transform (to follow slopes) caused it to slow down a bunch.

    When I instead do this:

    Code (csharp):
    1. void OnAnimatorMove() {
    2.     transform.position = animator.rootPosition;
    3.     transform.rotation = animator.rootRotation;
    4. }
    Everything looks great. The movement is just as I expect it to be, and there's no stuttering.


    So what is in ApplyBuildInRootMotion is doing that could affect the character in such a way? Does it assume that I don't move the transform manually at all? This is Unity 2018.4, if that matters.
     
    guycalledfrank likes this.