summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Unit/UnitRootMotion.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Unit/UnitRootMotion.cs')
-rw-r--r--Assets/Scripts/Unit/UnitRootMotion.cs6
1 files changed, 4 insertions, 2 deletions
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