[libgdx] Fixed physics scaleX when the bone world scale is 0.

This commit is contained in:
Nathan Sweet 2023-11-10 08:37:33 -04:00
parent 4b7f5b0a96
commit a4efb66d74

View File

@ -172,11 +172,15 @@ public class PhysicsConstraint implements Updatable {
r = rotateOffset * mix + ca; r = rotateOffset * mix + ca;
c = cos(r); c = cos(r);
s = sin(r); s = sin(r);
if (scaleX) scaleOffset += (dx * c + dy * s) * i / (l * bone.getWorldScaleX()); if (scaleX) {
r = l * bone.getWorldScaleX();
if (r > 0) scaleOffset += (dx * c + dy * s) * i / r;
}
} else { } else {
c = cos(ca); c = cos(ca);
s = sin(ca); s = sin(ca);
scaleOffset += ((cx - bone.worldX) * c + (cy - bone.worldY) * s) * i / (l * bone.getWorldScaleX()); float r = l * bone.getWorldScaleX();
if (r > 0) scaleOffset += ((cx - bone.worldX) * c + (cy - bone.worldY) * s) * i / r;
} }
remaining = this.remaining; remaining = this.remaining;
if (remaining >= step) { if (remaining >= step) {