mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[libgdx] Fixed PhysicsConstraint ignoring load scale. See commit c7a8123.
This commit is contained in:
parent
fa9028881d
commit
11e6428586
@ -325,8 +325,8 @@ public class SkeletonBinary extends SkeletonLoader {
|
|||||||
data.strength = input.readFloat();
|
data.strength = input.readFloat();
|
||||||
data.damping = input.readFloat();
|
data.damping = input.readFloat();
|
||||||
data.massInverse = input.readFloat();
|
data.massInverse = input.readFloat();
|
||||||
data.wind = input.readFloat();
|
data.wind = input.readFloat() * scale;
|
||||||
data.gravity = input.readFloat();
|
data.gravity = input.readFloat() * scale;
|
||||||
data.mix = input.readFloat();
|
data.mix = input.readFloat();
|
||||||
flags = input.read();
|
flags = input.read();
|
||||||
if ((flags & 1) != 0) data.inertiaGlobal = true;
|
if ((flags & 1) != 0) data.inertiaGlobal = true;
|
||||||
@ -992,10 +992,10 @@ public class SkeletonBinary extends SkeletonLoader {
|
|||||||
readTimeline(input, timelines, new PhysicsConstraintMassTimeline(frameCount, bezierCount, index), 1);
|
readTimeline(input, timelines, new PhysicsConstraintMassTimeline(frameCount, bezierCount, index), 1);
|
||||||
break;
|
break;
|
||||||
case PHYSICS_WIND:
|
case PHYSICS_WIND:
|
||||||
readTimeline(input, timelines, new PhysicsConstraintWindTimeline(frameCount, bezierCount, index), 1);
|
readTimeline(input, timelines, new PhysicsConstraintWindTimeline(frameCount, bezierCount, index), scale);
|
||||||
break;
|
break;
|
||||||
case PHYSICS_GRAVITY:
|
case PHYSICS_GRAVITY:
|
||||||
readTimeline(input, timelines, new PhysicsConstraintGravityTimeline(frameCount, bezierCount, index), 1);
|
readTimeline(input, timelines, new PhysicsConstraintGravityTimeline(frameCount, bezierCount, index), scale);
|
||||||
break;
|
break;
|
||||||
case PHYSICS_MIX:
|
case PHYSICS_MIX:
|
||||||
readTimeline(input, timelines, new PhysicsConstraintMixTimeline(frameCount, bezierCount, index), 1);
|
readTimeline(input, timelines, new PhysicsConstraintMixTimeline(frameCount, bezierCount, index), 1);
|
||||||
|
|||||||
@ -310,8 +310,8 @@ public class SkeletonJson extends SkeletonLoader {
|
|||||||
data.strength = constraintMap.getFloat("strength", 100);
|
data.strength = constraintMap.getFloat("strength", 100);
|
||||||
data.damping = constraintMap.getFloat("damping", 1);
|
data.damping = constraintMap.getFloat("damping", 1);
|
||||||
data.massInverse = 1f / constraintMap.getFloat("mass", 1);
|
data.massInverse = 1f / constraintMap.getFloat("mass", 1);
|
||||||
data.wind = constraintMap.getFloat("wind", 0);
|
data.wind = constraintMap.getFloat("wind", 0) * scale;
|
||||||
data.gravity = constraintMap.getFloat("gravity", 0);
|
data.gravity = constraintMap.getFloat("gravity", 0) * scale;
|
||||||
data.mix = constraintMap.getFloat("mix", 1);
|
data.mix = constraintMap.getFloat("mix", 1);
|
||||||
data.inertiaGlobal = constraintMap.getBoolean("inertiaGlobal", false);
|
data.inertiaGlobal = constraintMap.getBoolean("inertiaGlobal", false);
|
||||||
data.strengthGlobal = constraintMap.getBoolean("strengthGlobal", false);
|
data.strengthGlobal = constraintMap.getBoolean("strengthGlobal", false);
|
||||||
@ -957,6 +957,7 @@ public class SkeletonJson extends SkeletonLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CurveTimeline1 timeline;
|
CurveTimeline1 timeline;
|
||||||
|
float timelineScale = 1.0f;
|
||||||
if (timelineName.equals("inertia"))
|
if (timelineName.equals("inertia"))
|
||||||
timeline = new PhysicsConstraintInertiaTimeline(frames, frames, index);
|
timeline = new PhysicsConstraintInertiaTimeline(frames, frames, index);
|
||||||
else if (timelineName.equals("strength"))
|
else if (timelineName.equals("strength"))
|
||||||
@ -965,15 +966,17 @@ public class SkeletonJson extends SkeletonLoader {
|
|||||||
timeline = new PhysicsConstraintDampingTimeline(frames, frames, index);
|
timeline = new PhysicsConstraintDampingTimeline(frames, frames, index);
|
||||||
else if (timelineName.equals("mass"))
|
else if (timelineName.equals("mass"))
|
||||||
timeline = new PhysicsConstraintMassTimeline(frames, frames, index);
|
timeline = new PhysicsConstraintMassTimeline(frames, frames, index);
|
||||||
else if (timelineName.equals("wind"))
|
else if (timelineName.equals("wind")) {
|
||||||
timeline = new PhysicsConstraintWindTimeline(frames, frames, index);
|
timeline = new PhysicsConstraintWindTimeline(frames, frames, index);
|
||||||
else if (timelineName.equals("gravity"))
|
timelineScale = scale;
|
||||||
|
} else if (timelineName.equals("gravity")) {
|
||||||
timeline = new PhysicsConstraintGravityTimeline(frames, frames, index);
|
timeline = new PhysicsConstraintGravityTimeline(frames, frames, index);
|
||||||
else if (timelineName.equals("mix")) //
|
timelineScale = scale;
|
||||||
|
} else if (timelineName.equals("mix")) //
|
||||||
timeline = new PhysicsConstraintMixTimeline(frames, frames, index);
|
timeline = new PhysicsConstraintMixTimeline(frames, frames, index);
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
timelines.add(readTimeline(keyMap, timeline, 0, 1));
|
timelines.add(readTimeline(keyMap, timeline, 0, timelineScale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user