From 7996f2bae063c46c813192788769b0346ea98ad9 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Thu, 16 Aug 2018 02:21:11 +0200 Subject: [PATCH] [libgdx] Prevent rotation from spinning out of control. For example, when diff is -360 at the == 0 check, it later becomes 0. --- .../src/com/esotericsoftware/spine/AnimationState.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java index ebf790680..3bf31aeb2 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java @@ -356,10 +356,10 @@ public class AnimationState { // Mix between rotations using the direction of the shortest route on the first frame. float r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation; float total, diff = r2 - r1; + diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360; if (diff == 0) total = timelinesRotation[i]; else { - diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360; float lastTotal, lastDiff; if (firstFrame) { lastTotal = 0;