This commit is contained in:
2026-04-03 22:46:17 +07:00
parent 72f2a5f3e8
commit 95b94260ac
367 changed files with 94940 additions and 648 deletions

View File

@@ -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;