diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs index ac5994eb3..60e5edbc5 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs @@ -568,9 +568,9 @@ namespace Spine.Unity { } /// When enabled, Transform translation is applied to skeleton PhysicsConstraints. - public bool applyTranslationToPhysics = true; + [SerializeField] protected bool applyTranslationToPhysics = true; /// When enabled, Transform rotation is applied to skeleton PhysicsConstraints. - public bool applyRotationToPhysics = true; + [SerializeField] protected bool applyRotationToPhysics = true; /// Reference transform relative to which physics movement will be calculated, or null to use world location. [SerializeField] protected Transform physicsMovementRelativeTo = null; @@ -579,6 +579,28 @@ namespace Spine.Unity { /// Used for applying Transform rotation to skeleton PhysicsConstraints. protected float lastRotation; + /// When enabled, Transform translation is applied to skeleton PhysicsConstraints. + public bool ApplyTranslationToPhysics { + get { + return applyTranslationToPhysics; + } + set { + if (value && !applyTranslationToPhysics) ResetLastPosition(); + applyTranslationToPhysics = value; + } + } + + /// When enabled, Transform rotation is applied to skeleton PhysicsConstraints. + public bool ApplyRotationToPhysics { + get { + return applyRotationToPhysics; + } + set { + if (value && !applyRotationToPhysics) ResetLastRotation(); + applyRotationToPhysics = value; + } + } + /// Reference transform relative to which physics movement will be calculated, or null to use world location. public Transform PhysicsMovementRelativeTo { get { diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs index a07f2cde4..41ee7ecd3 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs @@ -290,9 +290,9 @@ namespace Spine.Unity { #region Physics /// When enabled, Transform translation is applied to skeleton PhysicsConstraints. - public bool applyTranslationToPhysics = true; + [SerializeField] protected bool applyTranslationToPhysics = true; /// When enabled, Transform rotation is applied to skeleton PhysicsConstraints. - public bool applyRotationToPhysics = true; + [SerializeField] protected bool applyRotationToPhysics = true; /// Reference transform relative to which physics movement will be calculated, or null to use world location. [SerializeField] protected Transform physicsMovementRelativeTo = null; @@ -301,6 +301,28 @@ namespace Spine.Unity { /// Used for applying Transform rotation to skeleton PhysicsConstraints. protected float lastRotation; + /// When enabled, Transform translation is applied to skeleton PhysicsConstraints. + public bool ApplyTranslationToPhysics { + get { + return applyTranslationToPhysics; + } + set { + if (value && !applyTranslationToPhysics) ResetLastPosition(); + applyTranslationToPhysics = value; + } + } + + /// When enabled, Transform rotation is applied to skeleton PhysicsConstraints. + public bool ApplyRotationToPhysics { + get { + return applyRotationToPhysics; + } + set { + if (value && !applyRotationToPhysics) ResetLastRotation(); + applyRotationToPhysics = value; + } + } + /// Reference transform relative to which physics movement will be calculated, or null to use world location. public Transform PhysicsMovementRelativeTo { get {