• Runtimes
  • what algorithm the Spine use when interpolating angles?

Related Discussions
...

I'm implementing Spine integration into a custom engine just from the exported JSON, without using the runtime.

I need to know that when an animation involves interpolating between rotations should I always interpolate along the smaller angle? i.e. if theta1 is 0 and and theta2 is 270, you could travel through positive 270 degrees to get from theta1 to theta2 counter-clockwise or could travel through -90 degrees to get to theta2 clockwise. Does spine always choose the latter because 90 is less than 270?

2 months later

Yep, the smaller rotation direction is used.


I should have been more clear in my answer.

When the Spine Runtimes mix (interpolate) world rotations from different poses (eg AnimationState tracks) then my answer is correct: the smaller rotation direction (at the start of the mixing) is used. This is what I was thinking of, but now I see it probably wasn't what you were asking.

To interpolate between two keys in a rotate timeline, before 4.0 my answer is also correct: you would rotate in the smaller direction. However in 4.0+ you just interpolate between the key values without caring about which way around is shortest. The rotation direction that results depends on the values used. Smaller to larger goes one way, larger to smaller goes the other.