# Animation curve from 340 to 0 when it should be 340 to 360

I am doing alot of animation on a character in code, by manually adding frames to animation curves with the addkey command.

I’ve run into a bit of a pickle.

If I make an animation curve to be used on a rotating transform, and I add a key of 340, then the next key in the timeline is at 0, well to make the animation look correct the curve needs to interpolate from 340 to 360. But it is instead interpolating from 340 to 0!

Is there some function to set on animation curves to make it recognize 360 as being the same as 0? So then it will interpolate to 340 to 360 if the next key is 0.

no one has any ideas at all?

Im really stumped on getting this to work

Have you tried using zero as the next key instead of 360? I must admit, I’m a bit stumped because quaternion interpolation usually uses the smallest angle of rotation. I’ll see if I can dig anything up from the developers.

Hi eem,

This is somewhat expected result, of course it’s not what you want what happens it takes last angle (let’s say 0, 0, 360) and converts it to quaternion (without paying attention to neighbor quaternions) and you get the same quaternion as if you would convert Euler angles (0, 0, 0). You could try using 359 or something close to that, but the real solution in such cases is using quaternions (and understanding double coverage).

My suggestion would be:

• Describe what you are trying to do and we might be able to suggest some other solution for you.
• Try playing with values close to 360.
• Just play animation “manually”, i.e. create a curve (which represents euler angles), then sample it yourself and set it on your object.
• Make a minimal repro case and send it to me - I might be able to take inside look, but I doubt that I will be able to help you, because for proper solution I think you would need new API.

Regards.
Paulius