Animating: Object does not rotate as it should.

I’m using the Animation window to animate the main camera flying through my scene. This works well because the camera moves very smoothly and I can control the exact timing between each point, which is critical.

I’ve started by moving the camera around a sphere. Position works perfectly. However, at a certain point, the camera will do a 360 spin.

Imagine you’re facing on a heading of 350 degrees, and you want to face at a heading of 10 degrees. Instead of turning to the right 20 degrees, the camera rotates to the left 340 degrees.

Worst case scenario, I re-arrange my scene into a hallway system in which the camera never looks back towards the start of the hallway. This option honestly disgusts me, but it might be what must be done.

Mid-case scenario, I add the 3 lines of code unity overlooked to the animation system. Is this even possible? How would I access the code?

Best case scenario, I am foolish and simply need to adjust a setting. What setting would that be? How do I get to it?

Best-Case Scenario!

If anyone else is struggling with this problem, Here’s what you need to do:

  1. Right click “Rotation” on the left side of the animation pane
  2. Hover “Interpolation”
  3. Select Quaternion

If by any chance after this you experience a shaking effect, select the keyframes in question, right click, and select “flat”.

Which version of Unity are you using? I remember a similar 360 animation bug that was fixed in either 5.3 or 5.4.

this fixed the problem for me

make sure “apply root motion” is unchecked