diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java index 1b2406c17..9b6357d4b 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java @@ -2303,7 +2303,7 @@ public void apply (Skeleton skeleton, float lastTime, float time, @Null Array= step) { - float m = this.mass * step, e = this.strength, w = wind * 100, g = gravity * -100; - float d = (float)Math.pow(this.damping, 60 * step); + float m = massInverse * step, e = strength, w = wind * 100, g = gravity * -100; + float d = (float)Math.pow(damping, 60 * step); do { if (x) { xVelocity += (w - xOffset * e) * m; @@ -154,6 +154,7 @@ public void update (Physics physics) { xVelocity *= d; } if (y) { + System.out.println(massInverse); yVelocity += (g - yOffset * e) * m; yOffset += yVelocity * step; yVelocity *= d; @@ -180,8 +181,8 @@ public void update (Physics physics) { } remaining = this.remaining; if (remaining >= step) { - float m = this.mass * step, e = this.strength, w = wind, g = gravity; - float d = (float)Math.pow(this.damping, 60 * step); + float m = massInverse * step, e = strength, w = wind, g = gravity; + float d = (float)Math.pow(damping, 60 * step); while (true) { remaining -= step; if (scaleX) { @@ -281,13 +282,12 @@ public void setDamping (float damping) { this.damping = damping; } - /** The inverse of the mass. */ - public float getMass () { - return mass; + public float getMassInverse () { + return massInverse; } - public void setMass (float mass) { - this.mass = mass; + public void setMassInverse (float massInverse) { + this.massInverse = massInverse; } public float getWind () { diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraintData.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraintData.java index 9f2c6d115..272f9fd4c 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraintData.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraintData.java @@ -35,7 +35,7 @@ public class PhysicsConstraintData extends ConstraintData { BoneData bone; boolean x, y, rotate, scaleX, shearX; - float step, inertia, strength, damping, mass, wind, gravity, mix; + float step, inertia, strength, damping, massInverse, wind, gravity, mix; public PhysicsConstraintData (String name) { super(name); @@ -122,13 +122,12 @@ public void setDamping (float damping) { this.damping = damping; } - /** The inverse of the mass. */ - public float getMass () { - return mass; + public float getMassInverse () { + return massInverse; } - public void setMass (float mass) { - this.mass = mass; + public void setMassInverse (float massInverse) { + this.massInverse = massInverse; } public float getWind () { diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java index e7d9336f1..5fa936a47 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java @@ -320,7 +320,7 @@ public SkeletonData readSkeletonData (InputStream dataInput) { data.inertia = input.readFloat(); data.strength = input.readFloat(); data.damping = input.readFloat(); - data.mass = input.readFloat(); + data.massInverse = input.readFloat(); data.wind = input.readFloat(); data.gravity = input.readFloat(); data.mix = input.readFloat();