When AnimationState mixes rotation between two animations, it needs to choose to mix either clockwise or counter-clockwise. On the first frame of the mix, it chooses the direction that results in the smallest rotation. It then uses that direction for the rest of the mix. Sometimes that may not be the direction you want.
For example, the rotation could be 175 degrees around one way and 185 the other. Those are similar and one may look better than the other, but Spine will choose the shorter rotation direction (175) and use that same direction for the rest of the mix.
Problems can also occur when the shortest direction becomes the longer direction after the first frame of the mix. Remember we are mixing two animations that change over time. The animations may be rotating the bones in a way that makes the direction that was the shortest at the start of the mix become the longer direction for most of the rest of the mix. That may look odd in some cases.
My guess is that is the cause of your problem: your animations are making large rotations and the initially chosen shortest rotation mix direction becomes the larger way around shortly after the mix starts.
You could try using a shorter mix duration and see if the problem goes away. A mix duration of 0 won't have the problem, of course, but may not look good. You may want to check if the rotation of the hip or root bone is very different from the idle rotation, indicating that your character is landing nearly upside down and the mix may not look good. In that case you could use a shorter mix duration, possibly even 0. Another way to check when the character has a lot of rotation compared to the landing pose could be the TrackEntry trackTime
of the jump/flipping animation.
By sticking with the initial choice for the rotation mix direction, AnimationState ensures there is no snapping during the mix. You can set TrackEntry shortestRotation
to true to have AnimationState use the shortest rotation mix direction of the current poses. Unfortunately this will result in snapping if the short way around becomes the long way around as the rotations from the animations change over time. That may look OK for your use case of the character landing from nearly upside down.
A related feature is TrackEntry resetRotationDirections
. This causes AnimationState to forget the current rotation mix directions. It will choose the shortest way around the next time the AnimationState is applied and remember that for the rest of the mix. resetRotationDirections
can be useful when using alpha
and starting animations on other tracks, but may not be helpful for your problem.