From 1fcaba8c85b3d6dc6191f237308d75295ab487a1 Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Tue, 21 Nov 2023 20:59:08 -0400 Subject: [PATCH] [libgdx] Fixed some physics constraint behavior when strength is 0. --- .../com/esotericsoftware/spine/PhysicsConstraint.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraint.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraint.java index 39b9ccfe1..ca9b9cae0 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraint.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraint.java @@ -164,11 +164,12 @@ public void update (Physics physics) { if (y) bone.worldY += yOffset * mix * data.y; } if (rotateOrShearX || scaleX) { - float ca = atan2(bone.c, bone.a), c, s; + float ca = atan2(bone.c, bone.a), c, s, mr = 0; if (rotateOrShearX) { - float dx = cx - bone.worldX, dy = cy - bone.worldY, r = atan2(dy + ty, dx + tx) - ca - rotateOffset * mix; + mr = mix * data.rotate; + float dx = cx - bone.worldX, dy = cy - bone.worldY, r = atan2(dy + ty, dx + tx) - ca - rotateOffset * mr; rotateOffset += (r - (float)Math.ceil(r * invPI2 - 0.5f) * PI2) * i; - r = rotateOffset * mix + ca; + r = rotateOffset * mr + ca; c = cos(r); s = sin(r); if (scaleX) { @@ -197,7 +198,7 @@ public void update (Physics physics) { rotateOffset += rotateVelocity * step; rotateVelocity *= d; if (remaining < step) break; - float r = rotateOffset * mix + ca; + float r = rotateOffset * mr + ca; c = cos(r); s = sin(r); } else if (remaining < step) //