From d189e686563820947bf47ebeac2843cfdfe59d12 Mon Sep 17 00:00:00 2001 From: BobSong <605277374@qq.com> Date: Wed, 10 Sep 2025 22:49:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E8=84=9A=E6=9C=AC=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Fishing2/Unit/Unity/CharacterControllerComponent.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/Fishing2/Unit/Unity/CharacterControllerComponent.cs b/Assets/Scripts/Fishing2/Unit/Unity/CharacterControllerComponent.cs index 976e92933..acf5050e0 100644 --- a/Assets/Scripts/Fishing2/Unit/Unity/CharacterControllerComponent.cs +++ b/Assets/Scripts/Fishing2/Unit/Unity/CharacterControllerComponent.cs @@ -17,7 +17,6 @@ namespace NBF.Fishing2 public Transform transform => characterController.transform; private MoveState currentMoveState; - private Vector3 networkPosition; // private Vector3 networkFacingDirection; // 添加目标位置和旋转用于插值 @@ -253,7 +252,6 @@ namespace NBF.Fishing2 private void StartMovement(MoveState moveState) { - networkPosition = moveState.startPosition; targetPosition = moveState.startPosition; Debug.Log($"开始移动 - 位置: {moveState.startPosition}"); @@ -261,7 +259,6 @@ namespace NBF.Fishing2 private void StopMovement(MoveState moveState) { - networkPosition = moveState.startPosition; targetPosition = moveState.startPosition; Debug.Log($"停止移动 - 最终位置: {moveState.startPosition}"); } @@ -272,8 +269,7 @@ namespace NBF.Fishing2 Vector3 movementDirection = currentMoveState.moveDirection; Vector3 movement = movementDirection * currentMoveState.moveSpeed * Time.deltaTime; - networkPosition += movement; - targetPosition = networkPosition; + targetPosition += movement; characterController.Move(movement); // 如果移动方向不为零,可以自动更新朝向 @@ -360,4 +356,4 @@ namespace NBF.Fishing2 #endregion } -} \ No newline at end of file +}