mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[unity] PhysicsConstraints: Made physicsMovementRelativeTo protected, added getter/setter automatically resetting last position (see commit 4266c72).
This commit is contained in:
parent
b850ff7715
commit
2a42f1a160
@ -572,13 +572,25 @@ namespace Spine.Unity {
|
||||
/// <summary>When enabled, Transform rotation is applied to skeleton PhysicsConstraints.</summary>
|
||||
public bool applyRotationToPhysics = true;
|
||||
/// <summary>Reference transform relative to which physics movement will be calculated, or null to use world location.</summary>
|
||||
public Transform physicsMovementRelativeTo = null;
|
||||
[SerializeField] protected Transform physicsMovementRelativeTo = null;
|
||||
|
||||
/// <summary>Used for applying Transform translation to skeleton PhysicsConstraints.</summary>
|
||||
protected Vector2 lastPosition;
|
||||
/// <summary>Used for applying Transform rotation to skeleton PhysicsConstraints.</summary>
|
||||
protected float lastRotation;
|
||||
|
||||
/// <summary>Reference transform relative to which physics movement will be calculated, or null to use world location.</summary>
|
||||
public Transform PhysicsMovementRelativeTo {
|
||||
get {
|
||||
return physicsMovementRelativeTo;
|
||||
}
|
||||
set {
|
||||
physicsMovementRelativeTo = value;
|
||||
if (applyTranslationToPhysics) ResetLastPosition();
|
||||
if (applyRotationToPhysics) ResetLastRotation();
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetLastPosition () {
|
||||
lastPosition = GetPhysicsTransformPosition();
|
||||
}
|
||||
|
||||
@ -294,13 +294,25 @@ namespace Spine.Unity {
|
||||
/// <summary>When enabled, Transform rotation is applied to skeleton PhysicsConstraints.</summary>
|
||||
public bool applyRotationToPhysics = true;
|
||||
/// <summary>Reference transform relative to which physics movement will be calculated, or null to use world location.</summary>
|
||||
public Transform physicsMovementRelativeTo = null;
|
||||
[SerializeField] protected Transform physicsMovementRelativeTo = null;
|
||||
|
||||
/// <summary>Used for applying Transform translation to skeleton PhysicsConstraints.</summary>
|
||||
protected Vector2 lastPosition;
|
||||
/// <summary>Used for applying Transform rotation to skeleton PhysicsConstraints.</summary>
|
||||
protected float lastRotation;
|
||||
|
||||
/// <summary>Reference transform relative to which physics movement will be calculated, or null to use world location.</summary>
|
||||
public Transform PhysicsMovementRelativeTo {
|
||||
get {
|
||||
return physicsMovementRelativeTo;
|
||||
}
|
||||
set {
|
||||
physicsMovementRelativeTo = value;
|
||||
if (applyTranslationToPhysics) ResetLastPosition();
|
||||
if (applyRotationToPhysics) ResetLastRotation();
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetLastPosition () {
|
||||
lastPosition = GetPhysicsTransformPosition();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user