mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 09:46:02 +08:00
[csharp] Fixed PhysicsConstraint ignoring load scale.
This commit is contained in:
parent
92986788c1
commit
c7a81230ff
@ -312,8 +312,8 @@ namespace Spine {
|
|||||||
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;
|
||||||
@ -997,10 +997,10 @@ namespace Spine {
|
|||||||
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);
|
||||||
|
|||||||
@ -299,8 +299,8 @@ namespace Spine {
|
|||||||
data.strength = GetFloat(constraintMap, "strength", 100);
|
data.strength = GetFloat(constraintMap, "strength", 100);
|
||||||
data.damping = GetFloat(constraintMap, "damping", 1);
|
data.damping = GetFloat(constraintMap, "damping", 1);
|
||||||
data.massInverse = 1f / GetFloat(constraintMap, "mass", 1);
|
data.massInverse = 1f / GetFloat(constraintMap, "mass", 1);
|
||||||
data.wind = GetFloat(constraintMap, "wind", 0);
|
data.wind = GetFloat(constraintMap, "wind", 0) * scale;
|
||||||
data.gravity = GetFloat(constraintMap, "gravity", 0);
|
data.gravity = GetFloat(constraintMap, "gravity", 0) * scale;
|
||||||
data.mix = GetFloat(constraintMap, "mix", 1);
|
data.mix = GetFloat(constraintMap, "mix", 1);
|
||||||
data.inertiaGlobal = GetBoolean(constraintMap, "inertiaGlobal", false);
|
data.inertiaGlobal = GetBoolean(constraintMap, "inertiaGlobal", false);
|
||||||
data.strengthGlobal = GetBoolean(constraintMap, "strengthGlobal", false);
|
data.strengthGlobal = GetBoolean(constraintMap, "strengthGlobal", false);
|
||||||
@ -1036,6 +1036,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CurveTimeline1 timeline;
|
CurveTimeline1 timeline;
|
||||||
|
float timelineScale = 1.0f;
|
||||||
if (timelineName == "inertia")
|
if (timelineName == "inertia")
|
||||||
timeline = new PhysicsConstraintInertiaTimeline(frames, frames, index);
|
timeline = new PhysicsConstraintInertiaTimeline(frames, frames, index);
|
||||||
else if (timelineName == "strength")
|
else if (timelineName == "strength")
|
||||||
@ -1044,15 +1045,19 @@ namespace Spine {
|
|||||||
timeline = new PhysicsConstraintDampingTimeline(frames, frames, index);
|
timeline = new PhysicsConstraintDampingTimeline(frames, frames, index);
|
||||||
else if (timelineName == "mass")
|
else if (timelineName == "mass")
|
||||||
timeline = new PhysicsConstraintMassTimeline(frames, frames, index);
|
timeline = new PhysicsConstraintMassTimeline(frames, frames, index);
|
||||||
else if (timelineName == "wind")
|
else if (timelineName == "wind") {
|
||||||
timeline = new PhysicsConstraintWindTimeline(frames, frames, index);
|
timeline = new PhysicsConstraintWindTimeline(frames, frames, index);
|
||||||
else if (timelineName == "gravity")
|
timelineScale = scale;
|
||||||
|
}
|
||||||
|
else if (timelineName == "gravity") {
|
||||||
timeline = new PhysicsConstraintGravityTimeline(frames, frames, index);
|
timeline = new PhysicsConstraintGravityTimeline(frames, frames, index);
|
||||||
|
timelineScale = scale;
|
||||||
|
}
|
||||||
else if (timelineName == "mix") //
|
else if (timelineName == "mix") //
|
||||||
timeline = new PhysicsConstraintMixTimeline(frames, frames, index);
|
timeline = new PhysicsConstraintMixTimeline(frames, frames, index);
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
timelines.Add(ReadTimeline(ref keyMapEnumerator, timeline, 0, 1));
|
timelines.Add(ReadTimeline(ref keyMapEnumerator, timeline, 0, timelineScale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.spine-csharp",
|
"name": "com.esotericsoftware.spine.spine-csharp",
|
||||||
"displayName": "spine-csharp Runtime",
|
"displayName": "spine-csharp Runtime",
|
||||||
"description": "This plugin provides the spine-csharp core runtime.",
|
"description": "This plugin provides the spine-csharp core runtime.",
|
||||||
"version": "4.2.6",
|
"version": "4.2.7",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user