mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[unity] Fixed physics constraints ignoring Z movement when Y-rotated. Closes #2614.
This commit is contained in:
parent
4e5e47d375
commit
4fe9e4582d
@ -303,7 +303,7 @@ namespace Spine.Unity {
|
||||
[SerializeField] protected Transform physicsMovementRelativeTo = null;
|
||||
|
||||
/// <summary>Used for applying Transform translation to skeleton PhysicsConstraints.</summary>
|
||||
protected Vector2 lastPosition;
|
||||
protected Vector3 lastPosition;
|
||||
/// <summary>Used for applying Transform rotation to skeleton PhysicsConstraints.</summary>
|
||||
protected float lastRotation;
|
||||
|
||||
@ -520,8 +520,8 @@ namespace Spine.Unity {
|
||||
public virtual void ApplyTransformMovementToPhysics () {
|
||||
if (Application.isPlaying) {
|
||||
if (physicsPositionInheritanceFactor != Vector2.zero) {
|
||||
Vector2 position = GetPhysicsTransformPosition();
|
||||
Vector2 positionDelta = position - lastPosition;
|
||||
Vector3 position = GetPhysicsTransformPosition();
|
||||
Vector3 positionDelta = position - lastPosition;
|
||||
|
||||
positionDelta = transform.InverseTransformVector(positionDelta);
|
||||
if (physicsMovementRelativeTo != null) {
|
||||
@ -541,7 +541,7 @@ namespace Spine.Unity {
|
||||
}
|
||||
}
|
||||
|
||||
protected Vector2 GetPhysicsTransformPosition () {
|
||||
protected Vector3 GetPhysicsTransformPosition () {
|
||||
if (physicsMovementRelativeTo == null) {
|
||||
return transform.position;
|
||||
} else {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "com.esotericsoftware.spine.spine-unity",
|
||||
"displayName": "spine-unity Runtime",
|
||||
"description": "This plugin provides the spine-unity runtime core.",
|
||||
"version": "4.2.80",
|
||||
"version": "4.2.81",
|
||||
"unity": "2018.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user