diff options
Diffstat (limited to 'Assets/Scripts/AnimatorHandler.cs')
| -rw-r--r-- | Assets/Scripts/AnimatorHandler.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Assets/Scripts/AnimatorHandler.cs b/Assets/Scripts/AnimatorHandler.cs index deae0ac..f285dca 100644 --- a/Assets/Scripts/AnimatorHandler.cs +++ b/Assets/Scripts/AnimatorHandler.cs @@ -11,6 +11,9 @@ namespace DS /// </summary> public class AnimatorHandler : MonoBehaviour { + [Header("绑定")] + public Transform rootMotionRotation; // 将他妈的模型旋转绑定到 RootMotion + [Header("组件引用")] public PlayerLocomotion playerLocomotion; // 玩家移动控制器引用,用于传递根运动数据 public Animator animator; // 动画器组件引用 @@ -139,7 +142,7 @@ namespace DS { // 获取当前帧的根运动位移向量 var rootMotion = GetRootMotion(); - + // 输出调试日志,用于查看根运动数据 Debug.Log(rootMotion); @@ -174,6 +177,7 @@ namespace DS // 将 animator.velocity(动画驱动的速度向量)投影到法线定义的平面上 // Vector3.ProjectOnPlane 会去除向量中沿法线方向的分量 // 这样只保留水平方向的位移,避免 Y 轴上的微小波动影响角色位置 + // return Vector3.ProjectOnPlane(animator.velocity, normalVector); return Vector3.ProjectOnPlane(animator.velocity, normalVector); } } |
