Why can’t I rotate anything to be “more than 360 degrees or less than 0 degrees”?

Why can’t I rotate anything to be “more than 360 degrees or less than 0 degrees”?

I've been trying to make an animation in Unity, but most assets already come bundled with everything facing at 0 degrees, not to say it's a bad thing.
However, the problem I'm facing is that the animation keyframes aren't playing out correctly.
When this is done with raw measurements (simply dragging the XYZ rotations), negative and greater than 360 degree angles are taken account. But then again - Unity could be simply remapping them, whcih is not the case.
For example, the prop_robotArm prefab, found within Unity's Robot Factory asset pack has a rotator script that simply rotates the whole thing along the Y axis.
void OnFixedUpdate()
{
    transform.Rotate (new Vector3(0, rotateSpeed*Time.deltaTime,0));
}

Meaning that after slightly more than a full revolution, the Y rotation value should be more than 360 degrees, which it does end up becoming... Eventually.

Thinking that was possible, I tried to mimic this behavior by making the arm rotate 720 degrees (twice) in an animation file (this is not using the rotator.cs script attached to the body in the example above).
Instead, all I ended up was the arm's body staying still as 720 is the same as... 0 degrees in rotation changes.
So, I tried a second experiment; trying to rotate from 359 degrees to 1 degree (or -1 to 1 degree).
Just like above, it didn't go to plan. When the animation is run, it simply runs from 359, through every angle in-between before reaching 1, instead of 359, 360 (0) and 361 (1).
If you don't get what I mean, see the diagram below.

So, I was wondering, is there a way to allow for such rotation to be defined in an animation curve?
Every time I try doing it, any value greater than 360 (or lesser than 0) is replaced by its co-terminal counterpart that's between 0 and 359.999999...999.

Solutions/Answers:

Answer 1:

Unity supports two methods of animation interpolation:

  • Quaternion interpolation (the default)
  • Euler angle interpolation (what you’re expecting)

Quaternion interpolation is smoother, but doesn’t react gracefully to a single keyframe which rotates more than 180 degrees — as you’re seeing, it picks the shorter path, no matter what your intention was.

To quote from the Unity manual:

Quaternion interpolation cannot represent rotations larger than 180 degrees, because it is then shorter to go the other way around.

If rotations larger than 180 degrees are desired, additional keys must be placed in between.

You can either add more keyframes, or set each AnimationCurve to use Euler angle interpolation. Either option sounds a bit tedious, so it’s up to you which is easier for your workflow.

Answer 2:

In addition to what @rutter has mentioned, you can change animation view to “Curve” and adjust curves accordingly to achieve the smooth rotation

Answer 3:

Probably I am little late, but I have the solution for this:

Add an offset of 360 to each Euler angle, now you do not want to apply it every time, so check if the rotation of the desired angle is lesser than 180 that is when you do not add an offset of 360, if it is not, add an offset of 360. @aytimothy

References