Parcourir la source

[libgdx] Take skeleton scale into account when applying translation only IK constraint, see #2412

Mario Zechner il y a 1 an
Parent
commit
c11afb283d

+ 2 - 2
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java

@@ -182,8 +182,8 @@ public class IkConstraint implements Updatable {
 		float rotationIK = -bone.ashearX - bone.arotation, tx, ty;
 		switch (bone.data.transformMode) {
 		case onlyTranslation:
-			tx = targetX - bone.worldX;
-			ty = targetY - bone.worldY;
+			tx = (targetX - bone.worldX) * Math.signum(bone.skeleton.scaleX);
+			ty = (targetY - bone.worldY) * Math.signum(bone.skeleton.scaleY);
 			break;
 		case noRotationOrReflection:
 			float s = Math.abs(pa * pd - pb * pc) / Math.max(0.0001f, pa * pa + pc * pc);