Answer the question
In order to leave comments, you need to log in
How to understand that a point belongs to NavMesh?
Hello. Question about NavMesh. I want to randomly create objects on the map, but in such a way that they appear where the player can pass. Is it possible to get a random point on the NavMesh, or to understand if the NavMesh point belongs or not.
Answer the question
In order to leave comments, you need to log in
Either you need to ask the agent on the mesh if it is
NavMeshAgent.isOnNavMesh
https://docs.unity3d.com/ScriptReference/AI.NavMes...
Or immediately ask the mesh for the nearest valid point to your random
NavMesh.SamplePosition(...)
https ://docs.unity3d.com/ScriptReference/AI.NavMes...
And of course try to build a route to critical points on the level. So that no one gets stuck.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question