I’m trying to figure out what’s going on with an imported animation. The curves in the editor show some bizarre shapes that aren’t affected by keys, tangents or any of the other options.
I tried deleting all the affected keyframes and creating new ones but it doesn’t change anything. I’m not sure what has been set for these keys that’s making them go funky anyway. Two items with identical, albeit rotating in opposite directions, animations are exported. One works and this one has these funky curve/straight/curve lines instead of the linear interpolation I should get by setting both tangents to linear.
Ok, I found a setting which affects it. Changing from Quaternion Interpolation to Euler Angles. But why should this happen? Quaternions can be SLERP’ed and it should always be perfect. Why these weird zigzagging curves with Quaternion Interpolation?
Any idea what’s going wrong here? Should I provide the models and submit a bug report to get this looked into or can someone suggest why quaternion interpolation of rotation keys would have this effect?
I remember seeing things like this. This is not a bug.
The problem is caused by the fact that there is no 1 to 1 mapping from quaternions to Euler angles (and vice versa). Quarternions have double coverage, which means two quternions can be mapped to same Euler angles. Euler anlges can be less than 0 and more than 360, which means that there is infinite number of Euler engles which maps to same quaternion.
When animation is imported we make sure that quaternions are continuous, i.e. it always uses the shortest path between the quaternions. When you change interpolation mode (I don’t remember all details exactly, but I thinks that’s what happens), it converts curve from quaternions frame by frame, without making sure it’s continuous in Euler angles (because that would actually modify original curve), so you get discontinuities in Euler angles.
The idea is you’re not supposed to toggle between these modes (unless you know exactly what you’re doing). You should stick to one editing mode: for new animations it’s probably better to user Euler angles, for importer, it sounds like, quaternions is a better option. Most of 3d tools work in Euler angle interpolation mode, and some tools have ability to switch to quaternion interpolation (so you might be able to produce same results there).