diff options
author | chai <chaifix@163.com> | 2021-08-29 12:54:37 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-08-29 12:54:37 +0800 |
commit | de78537f8edc6cb162ba58520956255f7e53769d (patch) | |
tree | 1bf05e3910149bffb79fb0c96e9ef1e28ea126e1 /Assets/Scripts/Unit/UnitRootMotion.cs | |
parent | e2284510c40e2d637c28108b50df2e403d51ec1c (diff) |
*轴向改为xy
Diffstat (limited to 'Assets/Scripts/Unit/UnitRootMotion.cs')
-rw-r--r-- | Assets/Scripts/Unit/UnitRootMotion.cs | 6 |
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
|