Explorar el Código

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

Nathan Sweet hace 1 año
padre
commit
a4efb66d74

+ 6 - 2
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraint.java

@@ -172,11 +172,15 @@ public class PhysicsConstraint implements Updatable {
 						r = rotateOffset * mix + ca;
 						c = cos(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 {
 						c = cos(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;
 					if (remaining >= step) {