diff --git a/Assets/PlayerMovement.cs b/Assets/PlayerMovement.cs index c3898a4..e1f24af 100644 --- a/Assets/PlayerMovement.cs +++ b/Assets/PlayerMovement.cs @@ -14,7 +14,10 @@ public class PlayerMovement : NetworkBehaviour [Command] private void CmdMove(Vector3 destination) { - _navMeshAgent.SetDestination(destination); + if (NavMesh.SamplePosition(destination, out NavMeshHit hit, 1f, NavMesh.AllAreas)) + { + _navMeshAgent.SetDestination(hit.position); + } } #endregion