移动脚本修改
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user