- Home /
How to fix this Mechanim root motion problem?
I'm using mechanim to animate my character but i don't want to use the Aplly Root Motion function. The problem is that with the Aplly Root Motion set to false, the animation doesn't looks like it should look. Here's some GIFS to illustrate:
This is how it looks like in blender ( how i wanted it to look like inside of unity )
This is how it looks like inside of unity using the Legacy System (wich was great by the way).
This is how it looks like using Mechanim with Root Motion being Apllied ( it looks OK but, with time, the root bone gets out of alignment with it's parent object, so i can't leave it like that)
And this is how it looks like without Root Motion
I also can't leave it like that. Do you notice how the head rotates with the body? This is not how it should look like. Can somebody help fix this? I can't use legacy system for this project.
For the behaviour you are seeing in the last picture, I presume you are using humanoid. That makes sense for a model like this and if you want I$$anonymous$$ etc. but if it gets to it, a quick solution would be to use generic mode.
In humanoid mode, the animation of your rig is retargetted to Unity's simplified humanoid rig and this process can be greatly affected by various factors, including the avatar setup and your original rig setup. Ensure that you create the avatar using a clip with your model in the standard T-pose and that the muscle settings actually make sense and that should give you a good start, at least.
In humanoid mode, the actual root from your rig is ignored and a new one is calculated, based on the average joint positions, if I remember correctly. Play with the clips root settings in the model importer, such as the XZ position, to see if it helps.
As I said, if all else fails, generic should work fine.
By staring at your animations, I've noticed that this issue isn't the head. With root motion, your character animation's whole body is rotating slightly in a natural swinging manner. Since not applying root motion doesn't apply this rotation, the head isn't stabilized.
A couple ways to fix this are to: Write a root motion handling method, and only apply rotation. Apply root motion, but constrain motion via Rigidbody (You can still alter position manually if you don't need to use Physics.)