Tweaking rotation in timeline keyframes causes spinning

Going back through the timeline to clean up some animations, but using record to adjust any rotation axis in the editor on any keyframe causes the y-rotation to spike for that keyframe, causing the animated object to do a 360 spin as it approaches from the previous keyframe and again on its way to the next keyframe. This appears to be accompanied by the following error:

You are recording with an initial rotation offset. This may result in a misrepresentation of euler angles. When recording transform properties, it is recommended to reset rotation prior to recording

But even resetting the rotation property, as it suggests, doesn’t seem to have any effect on the problem.

I can tweak the rotation without problem by exclusively using the curve graph, but it feels like I’m missing something or doing something wrong. Can keyframe rotation not be easily altered using the scene editor?

Hi Terrasque,

Welcome to our community! :slight_smile:

The warning message means that you are supposed to set all values in the very first keyframe. If you do not do that, the animation takes the values from the first keyframe where those values are defined. This can result in an unexpected behaviour.

Set all values, including the rotation, in the first keyframe. Then test your animation. Maybe that’ll fix the problem. If not, please let me know what remaining issues you have.


See also:

Thanks for the response,

Unfortunately, resetting the rotation for the first keyframe in the animation track doesn’t seem to help. I’ve also tried resetting the Prerocorded Transforms in the Animation Track Inspector, but it retroactively offsets every keyframe on my entire timeline, and yet still does not prevent the spinning issue from happening. Does the solution require having to rebuild the entire animation track from the beginning?

More confusingly, the same error appears while editing the enemy ship’s animation track, but editing the rotation for it does not cause any type of spinning.

Worse yet, while trying to troubleshoot it myself, I somehow managed to delete my whole timeline and simultaneously save it. Restarting from the beginning and ensuring that the 0th frame starts with no rotation seems to have prevented the warning message from popping up, but after finishing this time and trying to go back and fine tune parts of the timeline, adjusting any rotation on any keyframe still causes the object to start spinning, now on the x-rotation as well as the y-rotation. It seems like whatever is causing it is unrelated to the error, and now I’m at a total loss for a solution.

edit: it’s now spinning wildly on all three rotation axes if I even so much as barely adjust the rotation in the editor. As far as I’m aware, I haven’t changed anything.

edit2: Without changing anything again, it’s now working normally. I’m not entirely sure what’s going on, but it seems like it may be a bug.

I think I have found the issue.
It looks like, sometimes, something causes the initial keyframe rotation to set itself to some equivalent multiple (for example: 0 becomes -360; this also does not appear to trigger the initial rotation offset warning). Once it does this, any adjustments made using the scene editor go wild. I’m unsure what’s causing the initial keyframe properties to change itself sometimes, but I at least know how to fix it when the issue occurs.

What you describe sounds like a known problem in Unity. Unity internally works with quaternions but displays Euler angles. The conversions cause these issues. Mathematically, 0 and -360 are “the same”, so the conversion itself is correct, but when you want to rotate towards these values, they are obviously not the same.

What you could try is to click the right mouse button on the rotation property and set “Interpolation” to “Quaternions”. You could also test the other options. And if that did not fix the issues in your animation, you’ll have to edit the values in the keyframes manually.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms