P
P
Pragma Games2022-01-05 13:14:29
Unity
Pragma Games, 2022-01-05 13:14:29

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

2 answer(s)
Z
zukrac, 2022-01-13
@PragmaGames

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.

F
freeExec, 2022-01-05
@freeExec

Yes, you build a route to a point, it is either built or not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question