diff options
| author | chai <chaifix@163.com> | 2020-10-26 21:33:09 +0800 |
|---|---|---|
| committer | chai <chaifix@163.com> | 2020-10-26 21:33:09 +0800 |
| commit | 97b64a629a95980d9a2f6c9e37b4cb44acf33a59 (patch) | |
| tree | 4eeea7d5e00048c2f9b83dc97401f8915608a9b6 /Assets/Scripts/Test/SaionjiScript.cs | |
| parent | 3d3f0b7ede44569ecaab523350feede9fee383c3 (diff) | |
*跳跃
Diffstat (limited to 'Assets/Scripts/Test/SaionjiScript.cs')
| -rw-r--r-- | Assets/Scripts/Test/SaionjiScript.cs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Assets/Scripts/Test/SaionjiScript.cs b/Assets/Scripts/Test/SaionjiScript.cs index 7fac11f3..03dfbf8d 100644 --- a/Assets/Scripts/Test/SaionjiScript.cs +++ b/Assets/Scripts/Test/SaionjiScript.cs @@ -49,11 +49,20 @@ public partial class SaionjiScript : MonoBehaviour, IInteractable void OnAnimatorMove()
{
Animator animator = GetComponent<Animator>();
-
- // animator.deltaPosition和animator.deltaRotation是animator做的root motion后的结果
- // 在后面做一个硬性约束z=0,将角色限制在z=0平面上
- if (animator)
+ if (animator == null)
+ return;
+
+ AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
+
+ if(stateInfo.IsTag("IgnoreRootMotion"))
+ {
+ // ignore root motion
+ Debug.Log("ignore root motion ");
+ }
+ else
{
+ // animator.deltaPosition和animator.deltaRotation是animator做的root motion后的结果
+ // 在后面做一个硬性约束z=0,将角色限制在z=0平面上
Vector3 position = transform.position;
position.x += animator.deltaPosition.x;
position.y += animator.deltaPosition.y;
|
