移动脚本修改
This commit is contained in:
@@ -17,7 +17,6 @@ namespace NBF.Fishing2
|
|||||||
public Transform transform => characterController.transform;
|
public Transform transform => characterController.transform;
|
||||||
private MoveState currentMoveState;
|
private MoveState currentMoveState;
|
||||||
|
|
||||||
private Vector3 networkPosition;
|
|
||||||
// private Vector3 networkFacingDirection;
|
// private Vector3 networkFacingDirection;
|
||||||
|
|
||||||
// 添加目标位置和旋转用于插值
|
// 添加目标位置和旋转用于插值
|
||||||
@@ -253,7 +252,6 @@ namespace NBF.Fishing2
|
|||||||
|
|
||||||
private void StartMovement(MoveState moveState)
|
private void StartMovement(MoveState moveState)
|
||||||
{
|
{
|
||||||
networkPosition = moveState.startPosition;
|
|
||||||
targetPosition = moveState.startPosition;
|
targetPosition = moveState.startPosition;
|
||||||
|
|
||||||
Debug.Log($"开始移动 - 位置: {moveState.startPosition}");
|
Debug.Log($"开始移动 - 位置: {moveState.startPosition}");
|
||||||
@@ -261,7 +259,6 @@ namespace NBF.Fishing2
|
|||||||
|
|
||||||
private void StopMovement(MoveState moveState)
|
private void StopMovement(MoveState moveState)
|
||||||
{
|
{
|
||||||
networkPosition = moveState.startPosition;
|
|
||||||
targetPosition = moveState.startPosition;
|
targetPosition = moveState.startPosition;
|
||||||
Debug.Log($"停止移动 - 最终位置: {moveState.startPosition}");
|
Debug.Log($"停止移动 - 最终位置: {moveState.startPosition}");
|
||||||
}
|
}
|
||||||
@@ -272,8 +269,7 @@ namespace NBF.Fishing2
|
|||||||
Vector3 movementDirection = currentMoveState.moveDirection;
|
Vector3 movementDirection = currentMoveState.moveDirection;
|
||||||
|
|
||||||
Vector3 movement = movementDirection * currentMoveState.moveSpeed * Time.deltaTime;
|
Vector3 movement = movementDirection * currentMoveState.moveSpeed * Time.deltaTime;
|
||||||
networkPosition += movement;
|
targetPosition += movement;
|
||||||
targetPosition = networkPosition;
|
|
||||||
characterController.Move(movement);
|
characterController.Move(movement);
|
||||||
|
|
||||||
// 如果移动方向不为零,可以自动更新朝向
|
// 如果移动方向不为零,可以自动更新朝向
|
||||||
@@ -360,4 +356,4 @@ namespace NBF.Fishing2
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user