[csharp] Port of commit 1fcaba8. Fixed some physics constraint behavior when strength is 0.

This commit is contained in:
Harald Csaszar 2023-11-22 14:47:25 +01:00
parent 855cae6953
commit 4c3c630e62

View File

@ -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) //