From 3b02a3fbab266c7dd7e43235afeede900ecc8ffc Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Thu, 11 Sep 2025 19:28:50 +0200 Subject: [PATCH] [csharp] Port of commit abb4362: PhysicsConstraint, cannot reuse wind/gravity values for rotation. --- spine-csharp/src/PhysicsConstraint.cs | 13 ++++++------- spine-csharp/src/package.json | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/spine-csharp/src/PhysicsConstraint.cs b/spine-csharp/src/PhysicsConstraint.cs index a5dfc6e0f..8a215affa 100644 --- a/spine-csharp/src/PhysicsConstraint.cs +++ b/spine-csharp/src/PhysicsConstraint.cs @@ -127,8 +127,8 @@ namespace Spine { ux = bx; uy = by; } else { - float a = remaining, i = p.inertia, f = skeleton.data.referenceScale, d = -1, m = 0, e = 0, ax = 0, ay = 0, - qx = data.limit * delta, qy = qx * Math.Abs(skeleton.ScaleY); + float a = remaining, i = p.inertia, f = skeleton.data.referenceScale, d = -1, m = 0, e = 0, qx = data.limit * delta, + qy = qx * Math.Abs(skeleton.ScaleY); qx *= Math.Abs(skeleton.ScaleX); if (x || y) { @@ -148,8 +148,8 @@ namespace Spine { m = t * p.massInverse; e = p.strength; float w = f * p.wind, g = f * p.gravity; - ax = (w * skeleton.windX + g * skeleton.gravityX) * skeleton.scaleX; - ay = (w * skeleton.windY + g * skeleton.gravityY) * skeleton.ScaleY; + float ax = (w * skeleton.windX + g * skeleton.gravityX) * skeleton.scaleX; + float ay = (w * skeleton.windY + g * skeleton.gravityY) * skeleton.ScaleY; do { if (x) { xVelocity += (ax - xOffset * e) * m; @@ -204,10 +204,9 @@ namespace Spine { d = (float)Math.Pow(p.damping, 60 * t); m = t * p.massInverse; e = p.strength; - float w = f * p.wind, g = f * p.gravity; - ax = (w * skeleton.windX + g * skeleton.gravityX) * skeleton.scaleX; - ay = (w * skeleton.windY + g * skeleton.gravityY) * skeleton.ScaleY; } + float ax = p.wind * skeleton.windX - p.gravity * skeleton.gravityX; + float ay = p.wind * skeleton.windY + p.gravity * skeleton.gravityY; float rs = rotateOffset, ss = scaleOffset, h = l / f; if (Spine.Bone.yDown) ay = -ay; while (true) { diff --git a/spine-csharp/src/package.json b/spine-csharp/src/package.json index 4708b5d78..83760f1cd 100644 --- a/spine-csharp/src/package.json +++ b/spine-csharp/src/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.spine-csharp", "displayName": "spine-csharp Runtime", "description": "This plugin provides the spine-csharp core runtime.", - "version": "4.3.8", + "version": "4.3.9", "unity": "2018.3", "author": { "name": "Esoteric Software",