Search Unity

Root Motion behaves differently after upgrading from 2018.2 to 2018.3

Discussion in 'Animation' started by marcpeyre, Jan 19, 2019.

  1. marcpeyre

    marcpeyre

    Joined:
    Jan 23, 2014
    Posts:
    15
    After upgrading to 2018.3 I've noticed that Animator Root Motion behaves differently. Having the "Apply Root Motion" disabled in the Animator Component, no longer disables the translation of the root bone. Possibly related to this from the release notes of 2018.3:
    I would like to know if there is another way to disable root motion if this really is a new feature and not a bug.

    2018.2 (root stays in place)

    2018.3 (root moves forward and then resets back to the origin)


    Reproduced with a clean project with only the character imported running in 2018.2.14f1 followed by a direct upgrade to 2018.3.2f1. The rig of the animated characted looks like this:
     
  2. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    Hey @marcpeyre,

    Pre-2018.3, our implementation of Root Motion was a bit inconsistent.
    • Playing an animation with curves on the Root Transform with "Apply Root Motion" OFF would move the Root Transform, but playing the same Animation with "Apply Root Motion" ON would not move the Root Transform at all
    • Playing an animation with a Root Transform defined in the Rig (with Root.<Something> curves in the clip) with Root Motion ON would move the object, but playing the same Animation with "Apply Root Motion" OFF would give an Animation that is neither the clip from the file nor the Root Motion result, but something weird in-between.
    In 2018.3, we've unified things so that the results are always coherent.

    • Playing an Animation with "Apply Root Motion" ON will apply animation on the root joint incrementally, either using Root Transform curves (e.g.:"m_LocalPosition"), Root Curves (e.g.: Root T and Root Q), or Motion Curves (Motion T and Motion Q)
    • Playing an Animation with "Apply Root Motion" OFF will apply animation just like the source file
    The previous behaviour that you were relying on (Root T and Root Q with "Apply Root Motion" OFF), was exactly the same as having "Apply Root Motion" ON and overriding OnAnimatorMove without applying the Root Motion.

    This behaviour doesn't directly exist anymore, but you can reproduce it by implementing your own OnAnimatorMove. I've attached a script to this email that shows how to do it. You should be able to get exactly the same behaviour by changing the enableRootMotion property of this script instead of changing "Apply Root Motion" on the Animator.
     

    Attached Files:

  3. marcpeyre

    marcpeyre

    Joined:
    Jan 23, 2014
    Posts:
    15
    Thanks! Works perfectly!
     
  4. christoffer-enedahl-hellothere

    christoffer-enedahl-hellothere

    Joined:
    Nov 21, 2013
    Posts:
    4
    This post saved us time while the root motion change already cost us hours.
     
  5. Guacamolay

    Guacamolay

    Joined:
    Jun 24, 2013
    Posts:
    63
    I'm also having this issue, however your script doesn't seem to solve my problem. Since updating to Unity 2018, my animator.deltaPosition returns (0, 0, 0) everytime OnAnimatorMove() is called. Has this delta position value changed too?

    Code (CSharp):
    1.     private void OnAnimatorMove()
    2.     {
    3.         if (animator == null)
    4.             animator = GetComponent<Animator>();
    5.      
    6.         if (enableRootMotion)
    7.         {
    8.             animator.ApplyBuiltinRootMotion();
    9.             CharacterController.AnimatorMove(animator.deltaPosition, animator.deltaRotation);
    10.         }
    11.     }
    Edit: The rig is humanoid, and from the "TwinBlades Animset Base" from the asset store
     
  6. S4UC1SS0N

    S4UC1SS0N

    Joined:
    May 29, 2014
    Posts:
    49
    I also can't find how to make a custom OnAnimatorMove and use the deltaPosition in Unity 2019.1 0f2, it's stay at 0,0,0 when i try.
    Is it not possible anymore to disable root motion on the AnimationController and read what the root motion would have been in a OnAnimatoMove method ?