mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-19 00:06:42 +08:00
[unity] Fixed ghost-movement of Ragdoll components: They did not update the RagdollParent transform. Activate correct behaviour by disabling the inspector property Old Ragdoll Behaviour which was introduced to automatically be backwards-compatible. Closes #1670.
This commit is contained in:
parent
6a317a1e3f
commit
3e93e2daf1
@ -68,6 +68,7 @@ namespace Spine.Unity.Examples {
|
||||
public int colliderLayer = 0;
|
||||
[Range(0, 1)]
|
||||
public float mix = 1;
|
||||
public bool oldRagdollBehaviour = true;
|
||||
#endregion
|
||||
|
||||
ISkeletonAnimation targetSkeletonComponent;
|
||||
@ -322,6 +323,12 @@ namespace Spine.Unity.Examples {
|
||||
var t = pair.Value;
|
||||
bool isStartingBone = b == StartingBone;
|
||||
Transform parentTransform = isStartingBone ? ragdollRoot : boneTable[b.Parent];
|
||||
if (!oldRagdollBehaviour && isStartingBone) {
|
||||
if (b != skeleton.RootBone) { // RagdollRoot is not skeleton root.
|
||||
ragdollRoot.localPosition = new Vector3(b.Parent.WorldX, b.Parent.WorldY, 0);
|
||||
ragdollRoot.localRotation = Quaternion.Euler(0, 0, GetPropagatedRotation(b.Parent));
|
||||
}
|
||||
}
|
||||
Vector3 parentTransformWorldPosition = parentTransform.position;
|
||||
Quaternion parentTransformWorldRotation = parentTransform.rotation;
|
||||
|
||||
|
||||
@ -71,6 +71,7 @@ namespace Spine.Unity.Examples {
|
||||
public int colliderLayer = 0;
|
||||
[Range(0, 1)]
|
||||
public float mix = 1;
|
||||
public bool oldRagdollBehaviour = true;
|
||||
#endregion
|
||||
|
||||
ISkeletonAnimation targetSkeletonComponent;
|
||||
@ -338,6 +339,13 @@ namespace Spine.Unity.Examples {
|
||||
var t = pair.Value;
|
||||
bool isStartingBone = (b == startingBone);
|
||||
Transform parentTransform = isStartingBone ? ragdollRoot : boneTable[b.Parent];
|
||||
if (!oldRagdollBehaviour && isStartingBone) {
|
||||
if (b != skeleton.RootBone) { // RagdollRoot is not skeleton root.
|
||||
ragdollRoot.localPosition = new Vector3(b.Parent.WorldX, b.Parent.WorldY, 0);
|
||||
ragdollRoot.localRotation = Quaternion.Euler(0, 0, GetPropagatedRotation(b.Parent));
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 parentTransformWorldPosition = parentTransform.position;
|
||||
Quaternion parentTransformWorldRotation = parentTransform.rotation;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user