Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How do I prevent root motion completely with a humanoid mecanim?

Discussion in 'Animation' started by kebrus, Dec 12, 2014.

  1. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    Hi guys, simple question (I guess)

    How do I prevent my character from drifting? Even if I turn on "bake into pose" in every setting the XZ position still changes a little. Is it even possible to not move at all without scripting?
     
  2. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    If you wan to completely shutdown the root motion, simple un-check Animator.ApplyRootMotion, but if you do this your avatar won't move at all. If what you want is control proceduraly your root motion, you can override MonoBehaviour.OnAnimatorMove and set manually your root transform position and orientation.
     
    kebrus and theANMATOR2b like this.
  3. medhue

    medhue

    Joined:
    Aug 24, 2014
    Posts:
    176
    Is it really moving, or is it just rotating. Something I've seen quite a few time, especially with looping animation, is the character slightly rotating. Most of the time, I usually lock the rotation too.
     
  4. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    That basically answers all, I did uncheck ApplyRootMotion for now, but since I lose some features i might have to override the animatiormove callback. I just thought baking into pose in XZ would solve it but i guess not if the animation leans to much or is too fast