- Home /
Importing animation, how to stop unity adding random interpolation and gimbal lock?
Hi,
I have a show-stopper of a problem with importing animations into Unity.
I'm exporting from maya, I've tried .fbx and .dae files, many different settings, I've got animation baked on single keys, I'm doing everything I can think of by the book, however, my animations are all glitchy once they're imported into Unity.
Upon inspection, I find that unity decides to add random interpolation to the keys at the start and end of each animation. Upon closer inspection (opening the Animation folder and selecting the keys to change their interpolation by hand), I find that it's also added gimbal flip to some of the bones, which I then need to fix.
Is there some setting on import that I haven't been able to find that will fix this?
I've tried changing the wrap mode to loop, but that doesn't change anything. The only thing I can see on the forums is to clean up the animations after import, which, considering the number of animations I have and the time I have to deliver, will harshly effect the quality of the work I am submitting.
Any help would be greatly appreciated.
Answer by SirCrazyNugget · Mar 14, 2014 at 02:05 AM
Gimbal lock's more of a disease than a feature which occurs when you're trying to rotate around 3 axis at once, quaternions can solve that problem though I'm not sure if you can choose to use them on importing the animations.
The only quick fix I can think of at the moment is rotating the model in Maya around different axis and exporting then localizing it again in Unity. Might hopefully overcome the problem of multiple axis being rotated?
Either way, Good luck!
Thanks for this answer.
I believe unity has automatic quarternion curves on import, as they are the reason for the random interpolation in the keys, which is my main issue at the moment.
I included the gimbal issue, as I thought it might point to a solution; suggesting that unity is rebaking the animation on import. Not sure whether this is the reason, cause, symptom, or just another random distraction from the real issue.
Thanks again for the speedy answer and the well wishes. I will post if this works, or I find another solution.
Answer by morganimation · Mar 18, 2014 at 06:00 AM
workaround
For anybody else who has this problem, here's how I've been able to solve - or reduce - it.
Seems the bug occurs when there are a lot of frames in the export, for example, if you have animated a all your character's animations in the one file.
Exporting the animations individually, starting at frame zero, with each key baked, appears to avoid the issue. Bit of a hassle, but ultimately better than trying to clean up the keys in Unity.
Good luck.