浏览代码

[libgdx] Fixed worldToLocalRotation and localToWorldRotation to account for local rotation and shearX.

NathanSweet 7 年之前
父节点
当前提交
3851e201d8
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java

+ 2 - 1
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java

@@ -547,11 +547,12 @@ public class Bone implements Updatable {
 	/** Transforms a world rotation to a local rotation. */
 	public float worldToLocalRotation (float worldRotation) {
 		float sin = sinDeg(worldRotation), cos = cosDeg(worldRotation);
-		return atan2(a * sin - c * cos, d * cos - b * sin) * radDeg;
+		return atan2(a * sin - c * cos, d * cos - b * sin) * radDeg + rotation - shearX;
 	}
 
 	/** Transforms a local rotation to a world rotation. */
 	public float localToWorldRotation (float localRotation) {
+		localRotation -= rotation - shearX;
 		float sin = sinDeg(localRotation), cos = cosDeg(localRotation);
 		return atan2(cos * c + sin * d, cos * a + sin * b) * radDeg;
 	}