Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity3d find y position on navmesh

private bool SetDestination(Vector3 targetDestination)
{
  NavMeshHit hit;
  if (NavMesh.SamplePosition(targetDestination, out hit, 1f, NavMesh.AllAreas))
  {
    agent.SetDestination(hit.position);
    return true;
  }
  return false;
}
 
PREVIOUS NEXT
Tagged: #find #position #navmesh
ADD COMMENT
Topic
Name
2+6 =