mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +08:00
Merge branch '4.0' into 4.1-beta
This commit is contained in:
commit
a135288a7c
@ -30,7 +30,7 @@
|
|||||||
// Contributed by: Mitch Thompson
|
// Contributed by: Mitch Thompson
|
||||||
|
|
||||||
#if UNITY_2019_2 || UNITY_2019_3 || UNITY_2019_4 || UNITY_2020_1 || UNITY_2020_2 // note: 2020.3+ uses old bahavior again
|
#if UNITY_2019_2 || UNITY_2019_3 || UNITY_2019_4 || UNITY_2020_1 || UNITY_2020_2 // note: 2020.3+ uses old bahavior again
|
||||||
#define HINGE_JOINT_NEW_BEHAVIOUR
|
#define HINGE_JOINT_2019_BEHAVIOUR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
@ -42,7 +42,7 @@ namespace Spine.Unity.Examples {
|
|||||||
public class SkeletonRagdoll2D : MonoBehaviour {
|
public class SkeletonRagdoll2D : MonoBehaviour {
|
||||||
static Transform parentSpaceHelper;
|
static Transform parentSpaceHelper;
|
||||||
|
|
||||||
#region Inspector
|
#region Inspector
|
||||||
[Header("Hierarchy")]
|
[Header("Hierarchy")]
|
||||||
[SpineBone]
|
[SpineBone]
|
||||||
public string startingBoneName = "";
|
public string startingBoneName = "";
|
||||||
@ -72,7 +72,7 @@ namespace Spine.Unity.Examples {
|
|||||||
[Range(0, 1)]
|
[Range(0, 1)]
|
||||||
public float mix = 1;
|
public float mix = 1;
|
||||||
public bool oldRagdollBehaviour = false;
|
public bool oldRagdollBehaviour = false;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
ISkeletonAnimation targetSkeletonComponent;
|
ISkeletonAnimation targetSkeletonComponent;
|
||||||
Skeleton skeleton;
|
Skeleton skeleton;
|
||||||
@ -110,7 +110,7 @@ namespace Spine.Unity.Examples {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region API
|
#region API
|
||||||
public Rigidbody2D[] RigidbodyArray {
|
public Rigidbody2D[] RigidbodyArray {
|
||||||
get {
|
get {
|
||||||
if (!isActive)
|
if (!isActive)
|
||||||
@ -174,7 +174,7 @@ namespace Spine.Unity.Examples {
|
|||||||
|
|
||||||
joint.GetComponent<Rigidbody2D>().mass = joint.connectedBody.mass * massFalloffFactor;
|
joint.GetComponent<Rigidbody2D>().mass = joint.connectedBody.mass * massFalloffFactor;
|
||||||
|
|
||||||
#if HINGE_JOINT_NEW_BEHAVIOUR
|
#if HINGE_JOINT_2019_BEHAVIOUR
|
||||||
float referenceAngle = (rbParent.transform.eulerAngles.z - t.eulerAngles.z + 360f) % 360f;
|
float referenceAngle = (rbParent.transform.eulerAngles.z - t.eulerAngles.z + 360f) % 360f;
|
||||||
float minAngle = referenceAngle - rotationLimit;
|
float minAngle = referenceAngle - rotationLimit;
|
||||||
float maxAngle = referenceAngle + rotationLimit;
|
float maxAngle = referenceAngle + rotationLimit;
|
||||||
@ -299,7 +299,7 @@ namespace Spine.Unity.Examples {
|
|||||||
var bone = skeleton.FindBone(boneName);
|
var bone = skeleton.FindBone(boneName);
|
||||||
return (bone != null && boneTable.ContainsKey(bone)) ? boneTable[bone].GetComponent<Rigidbody2D>() : null;
|
return (bone != null && boneTable.ContainsKey(bone)) ? boneTable[bone].GetComponent<Rigidbody2D>() : null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>Generates the ragdoll simulation's Transform and joint setup.</summary>
|
/// <summary>Generates the ragdoll simulation's Transform and joint setup.</summary>
|
||||||
void RecursivelyCreateBoneProxies (Bone b) {
|
void RecursivelyCreateBoneProxies (Bone b) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user