diff --git a/.gitignore b/.gitignore index 05130c8ff..6d310a719 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ /Assets/ResRaw/Effect/Z_Test /Assets/ResRaw/Effect/Z_Test.meta /Bundles/ +Assets/Scripts/sync.ffs_db +Assets/Scripts/sync.ffs_db.meta diff --git a/Assets/Scripts/Fishing2/Unit/Unity/CharacterControllerComponent.cs b/Assets/Scripts/Fishing2/Unit/Unity/CharacterControllerComponent.cs index acf5050e0..662122624 100644 --- a/Assets/Scripts/Fishing2/Unit/Unity/CharacterControllerComponent.cs +++ b/Assets/Scripts/Fishing2/Unit/Unity/CharacterControllerComponent.cs @@ -146,8 +146,16 @@ namespace NBF.Fishing2 Vector3 movementDirection = Vector3.zero; - movementDirection += Vector3.forward * movementInput.y; - movementDirection += Vector3.right * movementInput.x; + // 修改:根据角色当前朝向计算移动方向 + if (!isStop) + { + // 获取角色当前的右向和前向(在水平面上) + Vector3 characterRight = Vector3.ProjectOnPlane(characterController.transform.right, Vector3.up).normalized; + Vector3 characterForward = Vector3.ProjectOnPlane(characterController.transform.forward, Vector3.up).normalized; + + // 根据角色朝向计算实际移动方向 + movementDirection = characterForward * movementInput.y + characterRight * movementInput.x; + } Net.Send(new C2Map_Move() { @@ -293,7 +301,7 @@ namespace NBF.Fishing2 targetPosition, positionLerpSpeed * Time.deltaTime); - // 插值旋转 + // 插值旋转 - 使用更平滑的插值方法 characterController.transform.rotation = Quaternion.Slerp( characterController.transform.rotation, targetRotation, @@ -356,4 +364,4 @@ namespace NBF.Fishing2 #endregion } -} +} \ No newline at end of file