浏览代码

[libgdx] Prevent rotation from spinning out of control.

For example, when diff is -360 at the == 0 check, it later becomes 0.
NathanSweet 7 年之前
父节点
当前提交
7996f2bae0
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java

+ 1 - 1
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;