From de78537f8edc6cb162ba58520956255f7e53769d Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 29 Aug 2021 12:54:37 +0800 Subject: =?UTF-8?q?*=E8=BD=B4=E5=90=91=E6=94=B9=E4=B8=BAxy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Unit/UnitRootMotion.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Assets/Scripts/Unit/UnitRootMotion.cs') diff --git a/Assets/Scripts/Unit/UnitRootMotion.cs b/Assets/Scripts/Unit/UnitRootMotion.cs index c4d4b2c9..8c6edaa0 100644 --- a/Assets/Scripts/Unit/UnitRootMotion.cs +++ b/Assets/Scripts/Unit/UnitRootMotion.cs @@ -70,8 +70,9 @@ public class UnitRootMotion : UnitComponent public void UpdateRootMotion() { + // 因为Unti被旋转了90度,所以这里的deltaPosition的forward是x方向了 Vector3 dest = m_Owner.unitAnimation.animator.deltaPosition; - dest.x = 0; //限制x轴始终在x=0 + dest.z = 0; var state = m_Owner.unitAnimation.layers[0].stateInfo; if(state.IsTag("IgnoreY")) @@ -79,7 +80,8 @@ public class UnitRootMotion : UnitComponent dest.y = 0; } - m_Owner.transform.position += dest; + //m_Owner.transform.position += RootMotionUtility.ExchangeXZ(dest); // 不需要exchangeXZ + m_Owner.transform.position += dest; } #endif -- cgit v1.1-26-g67d0