From 4c3c630e624ba2c40ed4823da631aec171176721 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Wed, 22 Nov 2023 14:47:25 +0100 Subject: [PATCH] [csharp] Port of commit 1fcaba8. Fixed some physics constraint behavior when strength is 0. --- spine-csharp/src/PhysicsConstraint.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spine-csharp/src/PhysicsConstraint.cs b/spine-csharp/src/PhysicsConstraint.cs index a8de40b32..3d5770403 100644 --- a/spine-csharp/src/PhysicsConstraint.cs +++ b/spine-csharp/src/PhysicsConstraint.cs @@ -166,11 +166,12 @@ namespace Spine { if (y) bone.worldY += yOffset * mix * data.y; } if (rotateOrShearX || scaleX) { - float ca = (float)Math.Atan2(bone.c, bone.a), c, s; + float ca = (float)Math.Atan2(bone.c, bone.a), c, s, mr = 0; if (rotateOrShearX) { - float dx = cx - bone.worldX, dy = cy - bone.worldY, r = (float)Math.Atan2(dy + ty, dx + tx) - ca - rotateOffset * mix; + mr = mix * data.rotate; + float dx = cx - bone.worldX, dy = cy - bone.worldY, r = (float)Math.Atan2(dy + ty, dx + tx) - ca - rotateOffset * mr; rotateOffset += (r - (float)Math.Ceiling(r * MathUtils.InvPI2 - 0.5f) * MathUtils.PI2) * i; - r = rotateOffset * mix + ca; + r = rotateOffset * mr + ca; c = (float)Math.Cos(r); s = (float)Math.Sin(r); if (scaleX) { @@ -199,7 +200,7 @@ namespace Spine { rotateOffset += rotateVelocity * step; rotateVelocity *= d; if (remaining < step) break; - float r = rotateOffset * mix + ca; + float r = rotateOffset * mr + ca; c = (float)Math.Cos(r); s = (float)Math.Sin(r); } else if (remaining < step) //