...
This commit is contained in:
@@ -36,11 +36,16 @@ namespace OnlyScove.Scripts
|
||||
}
|
||||
|
||||
Vector3 inputDir = new Vector3(input.x, 0, input.y).normalized;
|
||||
Vector3 moveDirection = stateMachine.Cam != null ? stateMachine.Cam.PlanarRotation * inputDir : inputDir;
|
||||
|
||||
// DÙNG HƯỚNG CAMERA TỪ MẠNG ĐỂ ĐỒNG BỘ MÁY CHỦ
|
||||
Vector3 moveDirection = stateMachine.NetworkedCameraRotation * inputDir;
|
||||
moveDirection.y = 0; // Đảm bảo không bay lên trời
|
||||
moveDirection.Normalize();
|
||||
|
||||
if (stateMachine.Cam != null)
|
||||
if (stateMachine.Cam != null && stateMachine.Object.HasInputAuthority)
|
||||
{
|
||||
Debug.Log($"[PlayerMoveState] View: {(stateMachine.Cam.PlanarRotation.eulerAngles.y)}, InputDir: {inputDir}, MoveDir: {moveDirection}, PlayerRot: {stateMachine.transform.rotation.eulerAngles.y}");
|
||||
// Log chỉ hiện ở máy khách để debug hướng xoay
|
||||
// Debug.Log($"[Move] Input: {inputDir}, MoveDir: {moveDirection}");
|
||||
}
|
||||
|
||||
Vector3 velocity = moveDirection * stateMachine.WalkSpeed;
|
||||
|
||||
Reference in New Issue
Block a user