From d769c1a9308799f529428531606ec7932e6e4316 Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Tue, 27 Aug 2024 13:35:42 -1000 Subject: [PATCH] [libgdx] Fixed noRotationOrReflection with skeleton scale. --- .../src/com/esotericsoftware/spine/Bone.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java index cb955d3ac5..d8026e0431 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java @@ -153,11 +153,12 @@ public void updateWorldTransform (float x, float y, float rotation, float scaleX break; } case noRotationOrReflection: { + float sx = 1 / skeleton.scaleX, sy = 1 / skeleton.scaleY; + pa *= sx; + pc *= sy; float s = pa * pa + pc * pc, prx; if (s > 0.0001f) { - s = Math.abs(pa * pd - pb * pc) / s; - pa /= skeleton.scaleX; - pc /= skeleton.scaleY; + s = Math.abs(pa * pd * sy - pb * sx * pc) / s; pb = pc * s; pd = pa * s; prx = atan2Deg(pc, pa); @@ -441,10 +442,8 @@ public void updateAppliedTransform () { switch (inherit) { case noRotationOrReflection: { float s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc); - float sa = pa / skeleton.scaleX; - float sc = pc / skeleton.scaleY; - pb = -sc * s * skeleton.scaleX; - pd = sa * s * skeleton.scaleY; + pb = -pc * skeleton.scaleX * s / skeleton.scaleY; + pd = pa * skeleton.scaleY * s / skeleton.scaleX; pid = 1 / (pa * pd - pb * pc); ia = pd * pid; ib = pb * pid;