mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[unity] Made UpdateWorldTransform mode configurable at all ISkeletonAnimation components. Fixed SkeletonRootMotionBase physics update mode.
This commit is contained in:
parent
fd0c20a2c7
commit
2a31b4d9b1
@ -213,7 +213,7 @@ namespace Spine.Unity {
|
|||||||
Vector2 parentBoneScale;
|
Vector2 parentBoneScale;
|
||||||
GetScaleAffectingRootMotion(out parentBoneScale);
|
GetScaleAffectingRootMotion(out parentBoneScale);
|
||||||
ClearEffectiveBoneOffsets(parentBoneScale);
|
ClearEffectiveBoneOffsets(parentBoneScale);
|
||||||
skeletonComponent.Skeleton.UpdateWorldTransform(Skeleton.Physics.Update);
|
skeletonComponent.Skeleton.UpdateWorldTransform(Skeleton.Physics.Pose);
|
||||||
}
|
}
|
||||||
ClearRigidbodyTempMovement();
|
ClearRigidbodyTempMovement();
|
||||||
|
|
||||||
|
|||||||
@ -83,10 +83,15 @@ namespace Spine.Unity {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } }
|
public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary><para>
|
||||||
/// Occurs after the Skeleton's bone world space values are resolved (including all constraints).
|
/// Occurs after the Skeleton's bone world space values are resolved (including all constraints).
|
||||||
/// Using this callback will cause the world space values to be solved an extra time.
|
/// Using this callback will cause the world space values to be solved an extra time.
|
||||||
/// Use this callback if want to use bone world space values, and also set bone local values.</summary>
|
/// Use this callback if want to use bone world space values, and also set bone local values.
|
||||||
|
/// </para><para>
|
||||||
|
/// When used in combination with PhysicsConstraints at your skeleton, you might want to consider adjusting
|
||||||
|
/// <see cref="MainPhysicsUpdate"/> and <see cref="AdditionalPhysicsUpdate"/> to save updates by setting one to
|
||||||
|
/// <see cref="Skeleton.Physics.Pose"/>.
|
||||||
|
/// </para></summary>
|
||||||
public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } }
|
public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -104,6 +109,15 @@ namespace Spine.Unity {
|
|||||||
/// Instance SkeletonAnimation.timeScale will still be applied.</summary>
|
/// Instance SkeletonAnimation.timeScale will still be applied.</summary>
|
||||||
[SerializeField] protected bool unscaledTime;
|
[SerializeField] protected bool unscaledTime;
|
||||||
public bool UnscaledTime { get { return unscaledTime; } set { unscaledTime = value; } }
|
public bool UnscaledTime { get { return unscaledTime; } set { unscaledTime = value; } }
|
||||||
|
|
||||||
|
protected Skeleton.Physics mainPhysicsUpdate = Skeleton.Physics.Update;
|
||||||
|
protected Skeleton.Physics additionalPhysicsUpdate = Skeleton.Physics.Update;
|
||||||
|
/// <summary>Physics update mode used in the main call to skeleton.UpdateWorldTransform().</summary>
|
||||||
|
public Skeleton.Physics MainPhysicsUpdate { get { return mainPhysicsUpdate; } set { mainPhysicsUpdate = value; } }
|
||||||
|
/// <summary>Physics update mode used at optional additional calls to skeleton.UpdateWorldTransform(),
|
||||||
|
/// such as after the <see cref="UpdateWorld"/> callback if a method is subscribed at the UpdateWorld delegate.
|
||||||
|
/// </summary>
|
||||||
|
public Skeleton.Physics AdditionalPhysicsUpdate { get { return additionalPhysicsUpdate; } set { additionalPhysicsUpdate = value; } }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Serialized state and Beginner API
|
#region Serialized state and Beginner API
|
||||||
@ -264,11 +278,11 @@ namespace Spine.Unity {
|
|||||||
if (_UpdateLocal != null)
|
if (_UpdateLocal != null)
|
||||||
_UpdateLocal(this);
|
_UpdateLocal(this);
|
||||||
|
|
||||||
UpdateWorldTransform();
|
UpdateWorldTransform(mainPhysicsUpdate);
|
||||||
|
|
||||||
if (_UpdateWorld != null) {
|
if (_UpdateWorld != null) {
|
||||||
_UpdateWorld(this);
|
_UpdateWorld(this);
|
||||||
UpdateWorldTransform();
|
UpdateWorldTransform(additionalPhysicsUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_UpdateComplete != null) {
|
if (_UpdateComplete != null) {
|
||||||
|
|||||||
@ -403,19 +403,19 @@ namespace Spine.Unity {
|
|||||||
if (UpdateLocal != null)
|
if (UpdateLocal != null)
|
||||||
UpdateLocal(this);
|
UpdateLocal(this);
|
||||||
|
|
||||||
UpdateWorldTransform();
|
UpdateWorldTransform(mainPhysicsUpdate);
|
||||||
|
|
||||||
if (UpdateWorld != null) {
|
if (UpdateWorld != null) {
|
||||||
UpdateWorld(this);
|
UpdateWorld(this);
|
||||||
UpdateWorldTransform();
|
UpdateWorldTransform(additionalPhysicsUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UpdateComplete != null)
|
if (UpdateComplete != null)
|
||||||
UpdateComplete(this);
|
UpdateComplete(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void UpdateWorldTransform () {
|
protected void UpdateWorldTransform (Skeleton.Physics physics) {
|
||||||
skeleton.UpdateWorldTransform(Skeleton.Physics.Update);
|
skeleton.UpdateWorldTransform(physics);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LateUpdate () {
|
public void LateUpdate () {
|
||||||
@ -644,6 +644,15 @@ namespace Spine.Unity {
|
|||||||
[SerializeField] protected bool unscaledTime;
|
[SerializeField] protected bool unscaledTime;
|
||||||
public bool UnscaledTime { get { return unscaledTime; } set { unscaledTime = value; } }
|
public bool UnscaledTime { get { return unscaledTime; } set { unscaledTime = value; } }
|
||||||
|
|
||||||
|
protected Skeleton.Physics mainPhysicsUpdate = Skeleton.Physics.Update;
|
||||||
|
protected Skeleton.Physics additionalPhysicsUpdate = Skeleton.Physics.Update;
|
||||||
|
/// <summary>Physics update mode used in the main call to skeleton.UpdateWorldTransform().</summary>
|
||||||
|
public Skeleton.Physics MainPhysicsUpdate { get { return mainPhysicsUpdate; } set { mainPhysicsUpdate = value; } }
|
||||||
|
/// <summary>Physics update mode used at optional additional calls to skeleton.UpdateWorldTransform(),
|
||||||
|
/// such as after the <see cref="UpdateWorld"/> callback if a method is subscribed at the UpdateWorld delegate.
|
||||||
|
/// </summary>
|
||||||
|
public Skeleton.Physics AdditionalPhysicsUpdate { get { return additionalPhysicsUpdate; } set { additionalPhysicsUpdate = value; } }
|
||||||
|
|
||||||
/// <summary> Occurs after the vertex data populated every frame, before the vertices are pushed into the mesh.</summary>
|
/// <summary> Occurs after the vertex data populated every frame, before the vertices are pushed into the mesh.</summary>
|
||||||
public event Spine.Unity.MeshGeneratorDelegate OnPostProcessVertices;
|
public event Spine.Unity.MeshGeneratorDelegate OnPostProcessVertices;
|
||||||
|
|
||||||
|
|||||||
@ -63,10 +63,15 @@ namespace Spine.Unity {
|
|||||||
/// Use this callback when you want to set bone local values.</summary>
|
/// Use this callback when you want to set bone local values.</summary>
|
||||||
public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } }
|
public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary><para>
|
||||||
/// Occurs after the Skeleton's bone world space values are resolved (including all constraints).
|
/// Occurs after the Skeleton's bone world space values are resolved (including all constraints).
|
||||||
/// Using this callback will cause the world space values to be solved an extra time.
|
/// Using this callback will cause the world space values to be solved an extra time.
|
||||||
/// Use this callback if want to use bone world space values, and also set bone local values.</summary>
|
/// Use this callback if want to use bone world space values, and also set bone local values.
|
||||||
|
/// </para><para>
|
||||||
|
/// When used in combination with PhysicsConstraints at your skeleton, you might want to consider adjusting
|
||||||
|
/// <see cref="MainPhysicsUpdate"/> and <see cref="AdditionalPhysicsUpdate"/> to save updates by setting one to
|
||||||
|
/// <see cref="Skeleton.Physics.Pose"/>.
|
||||||
|
/// </para></summary>
|
||||||
public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } }
|
public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -77,6 +82,15 @@ namespace Spine.Unity {
|
|||||||
|
|
||||||
[SerializeField] protected UpdateTiming updateTiming = UpdateTiming.InUpdate;
|
[SerializeField] protected UpdateTiming updateTiming = UpdateTiming.InUpdate;
|
||||||
public UpdateTiming UpdateTiming { get { return updateTiming; } set { updateTiming = value; } }
|
public UpdateTiming UpdateTiming { get { return updateTiming; } set { updateTiming = value; } }
|
||||||
|
|
||||||
|
protected Skeleton.Physics mainPhysicsUpdate = Skeleton.Physics.Update;
|
||||||
|
protected Skeleton.Physics additionalPhysicsUpdate = Skeleton.Physics.Update;
|
||||||
|
/// <summary>Physics update mode used in the main call to skeleton.UpdateWorldTransform().</summary>
|
||||||
|
public Skeleton.Physics MainPhysicsUpdate { get { return mainPhysicsUpdate; } set { mainPhysicsUpdate = value; } }
|
||||||
|
/// <summary>Physics update mode used at optional additional calls to skeleton.UpdateWorldTransform(),
|
||||||
|
/// such as after the <see cref="UpdateWorld"/> callback if a method is subscribed at the UpdateWorld delegate.
|
||||||
|
/// </summary>
|
||||||
|
public Skeleton.Physics AdditionalPhysicsUpdate { get { return additionalPhysicsUpdate; } set { additionalPhysicsUpdate = value; } }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public override void Initialize (bool overwrite, bool quiet = false) {
|
public override void Initialize (bool overwrite, bool quiet = false) {
|
||||||
@ -156,11 +170,11 @@ namespace Spine.Unity {
|
|||||||
if (_UpdateLocal != null)
|
if (_UpdateLocal != null)
|
||||||
_UpdateLocal(this);
|
_UpdateLocal(this);
|
||||||
|
|
||||||
UpdateWorldTransform();
|
UpdateWorldTransform(mainPhysicsUpdate);
|
||||||
|
|
||||||
if (_UpdateWorld != null) {
|
if (_UpdateWorld != null) {
|
||||||
_UpdateWorld(this);
|
_UpdateWorld(this);
|
||||||
UpdateWorldTransform();
|
UpdateWorldTransform(additionalPhysicsUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_UpdateComplete != null)
|
if (_UpdateComplete != null)
|
||||||
|
|||||||
@ -423,7 +423,7 @@ namespace Spine.Unity {
|
|||||||
// Generate mesh once, required to update mesh bounds for visibility
|
// Generate mesh once, required to update mesh bounds for visibility
|
||||||
UpdateMode updateModeSaved = updateMode;
|
UpdateMode updateModeSaved = updateMode;
|
||||||
updateMode = UpdateMode.FullUpdate;
|
updateMode = UpdateMode.FullUpdate;
|
||||||
UpdateWorldTransform();
|
UpdateWorldTransform(Skeleton.Physics.Update);
|
||||||
LateUpdate();
|
LateUpdate();
|
||||||
updateMode = updateModeSaved;
|
updateMode = updateModeSaved;
|
||||||
|
|
||||||
@ -439,8 +439,8 @@ namespace Spine.Unity {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void UpdateWorldTransform () {
|
protected virtual void UpdateWorldTransform (Skeleton.Physics physics) {
|
||||||
skeleton.UpdateWorldTransform(Skeleton.Physics.Update);
|
skeleton.UpdateWorldTransform(physics);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -63,6 +63,8 @@ namespace Spine.Unity {
|
|||||||
event UpdateBonesDelegate UpdateComplete;
|
event UpdateBonesDelegate UpdateComplete;
|
||||||
Skeleton Skeleton { get; }
|
Skeleton Skeleton { get; }
|
||||||
UpdateTiming UpdateTiming { get; set; }
|
UpdateTiming UpdateTiming { get; set; }
|
||||||
|
Skeleton.Physics MainPhysicsUpdate { get; set; }
|
||||||
|
Skeleton.Physics AdditionalPhysicsUpdate { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Holds a reference to a SkeletonDataAsset.</summary>
|
/// <summary>Holds a reference to a SkeletonDataAsset.</summary>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.spine-unity",
|
"name": "com.esotericsoftware.spine.spine-unity",
|
||||||
"displayName": "spine-unity Runtime",
|
"displayName": "spine-unity Runtime",
|
||||||
"description": "This plugin provides the spine-unity runtime core.",
|
"description": "This plugin provides the spine-unity runtime core.",
|
||||||
"version": "4.2.35",
|
"version": "4.2.36",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user