aboutsummaryrefslogtreecommitdiff
path: root/Assets/Scripts
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts')
-rw-r--r--Assets/Scripts/AnimatorHandler.cs6
-rw-r--r--Assets/Scripts/InputHandler.cs2
2 files changed, 6 insertions, 2 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);
}
}
diff --git a/Assets/Scripts/InputHandler.cs b/Assets/Scripts/InputHandler.cs
index 4d0bba1..6da34f0 100644
--- a/Assets/Scripts/InputHandler.cs
+++ b/Assets/Scripts/InputHandler.cs
@@ -37,7 +37,7 @@ namespace DS
// ===== Unity 生命周期方法 =====
- private void Awake()
+ private void Start()
{
// 获取相机处理器的单例引用,用于在 FixedUpdate 中驱动相机跟随与旋转
_cameraHandler = CameraHandler.singleton;