- Home /
Root motion accuracy issue
I have a simple enemy prototype that has an animation controller consisting of two states - both have root motion and both downloaded from Mixamo
walking forward (default)
180 degrees turn (activates with trigger named "turn").
In code/script I make two boxcasts to see if there's a wall or a hole in the ground ahead and set the "turn" trigger if there are any obstacles ahead.
At first everything seemed to work fine, but over time I realized that the turn animation starts to drift off. The turn ends at (for example) 179 degrees instead of 180 and this difference gets bigger and bigger with every turn and finally character starts to walk diagonally.
I tried many different things.
It's not related to transitions - because I made the transition from turn to walking have 1 exit time with 0 transition/blend time.
Changing "offset" in animation import wizard didn't help - as well as turning off animation compression.
I did some trial-and-error testing and came up with hacky solution. When I change "update mode" on this character's animation controller to "Animate Physics" (instead of default "normal" mode), the rotations are always perfect 180 degrees turns and character never starts to walk diagonally.
My question is - is there any better, less "hacky" solution than changing the update mode? If not - can someone explain to me why is this necessary? I don't even have rigid body on this character.
Did you ever resolve this to an accurate solution?
I'm having the same problem translating an object using Root Motion, I want it to move for example 1 unit but it always seems to move some inaccurate amount near 1 unit such as 1.0389 or the like and each time it stacks causing it to be way off really quickly.
Your answer
Follow this Question
Related Questions
Is there any way to make the default animation transition instant? 2 Answers
Dynamically accessing value for multiple usage in AnimatorController transition conditions. 1 Answer
Animator animates feet in an animation without foot animation 1 Answer