- Home /
Having trouble removing root motion in animation, how do I fix this?
I have created a 3D model with appropriate animations in 3ds max and imported them successfully to Unity , I have separated out my walk cycle and it all looks good but when I put it on loop the character takes his two steps while walking forward then snaps back to the start of the loop. I had read you are able to use Mecanim to remove root motion either by toggling it off in the "Animator" section of the inspector or after switching the rig to humanoid through the animation inspector and then baking Root transforms into the pose.
I have tried both of these options and neither has solved my issue, any ideas would be fantastic! On a side note How can I have a loop match on everything apart from Root Transform Position (XY), surely I would only ever want to remove root motion if the last frame did not match the first? If there was a match why would I need to remove root motion?
Answer by theANMATOR2b · May 17, 2016 at 12:02 AM
Did you use biped to develop the animation? If so - in the motion panel under Modes & Display rollout, click In-Place Mode and re-export the animation. This removes the root motion (transformation only not rotation) of the bip even though the animation was created using root motion.
If you didn't use biped, simply zero out or remove the forward transformation of the root bone - then re-export.
Not sure about your second part of the question - it's worded oddly. Here is what I found in the forum that might help (copied from a post in the forum) This is a setup to control the character by code by removing root motion.
*Check the Root Transform Position (Y) + and (XZ) too. Try setting both as Baked into Pose + Original. What this seems to mean (trial and error here...) is that root of this clip is not moved at all during playback of this animation clip. This seems to be only setting making sense for animations that should be placed into world exactly, animated move across box platform and such, I think this can be thought as animation moving relative to 0,0,0 of Maya/Max/Blender world origin. This also negates the use Root Motion of Animator, with this setting it doesn't matter as clip settings itself already do this.
I did use the same settings for hanging and idle - Root Transform Rotation, Root Transform Position (Y) and Root Transform Position (XZ) too all are set as Bake into Pose + Original. With this I eliminated Unity from trying to add some calculated offsets during animation playback, making it hard to see what happens with translations.*
So I'm not totally sure what was causing the problem as I have solved it by simply starting a new project and going through the steps again, it appears to be working so I think I'm set, I was using a CAT rig rather than the biped but Ill bookmark this for the future as I intend to mess around with the biped at some point.
As far as 0'ing it out goes in my head that seems like it wouldn't work as the hip is the root bone and would be zeroed on key frames but the feet would be positioned in their previous locations? I get that it should because they are children of it and should move by the same amount but when I tried going frame by frame and setting the axis to 0 on the hip it totally scrambled the animation based on the feet locations being all over the place.
The second part of my question was worded poorly, honestly I wasn't sure how to word it essentially I was confused by what the "Loop $$anonymous$$atch" indicator means, since some where green and some were not, I thought it meant the last and first frame of the animation were identical but my rotation animations certainly weren't, yet still got rotation matches?
Ah - you are correct about zeroing out the forward motion when using I$$anonymous$$ legs. To solve with CAT - I think there is a process to zero root transform, however the process I know that works is to export as normal fbx, then reimport the fbx into $$anonymous$$ax. The fbx export converts all I$$anonymous$$ into F$$anonymous$$ but retains the motion of the root bone. On the re-imported rig - the forward motion can now be zeroed - as you did before, but it won't mess up the I$$anonymous$$ keys on the legs as previously experienced. After zeroing the root - you can re-export as fbx again, into Unity. Glad you solved the original issue.
well the way you are talking about seems preferable as fixing it on the 3ds$$anonymous$$ax end seems to make more sense, I'll be using this method next time I come across this method, thanks!
Worked like a charm for me! I tried messing with every FBX animation import setting in Unity (root motion XZ/Y options weren't showing up under Curves no matter what I did). Removing all keyframes on Bip001 in $$anonymous$$ax didn't work. Disabling root motion on the object via C# script didn't work. Clicking the In-Place $$anonymous$$ode in that panel eventually enabled me to move my character around without it snapping all over the place from hardcoded root transforms. Thanks!