- Home /
get height of point in NavMesh
I have a c# application with a NavMesh. Now i to place all objects of a specific type at the NavMesh height for this position. How can i Detect the height of a specific position on NavMesh?
I assume the NavMesh.SamplePosition() function is the right way to use it. But currently my check never gets true. Vector3 positionToCheck = gameObject.transform.position; if (NavMesh.SamplePosition(positionToCheck, out navMeshHit, 2, 0)) { gameObject.transform.position = navMeshHit.position; } Is there something i miss?
Answer by insominx · Nov 25, 2015 at 09:26 PM
You have the right approach (using SamplePosition) but passing an area mask of 0 will result in you never hitting anything. Try another value such as NavMesh.AllAreas.
Your answer
Follow this Question
Related Questions
Enemies using navmesh are bumping each other through solid objects 1 Answer
Navmesh y-axis 1 Answer
Navmesh agent got fused in very crowded situation when colliding. 0 Answers
How do I get NavMeshAgents not to walk through objects? 3 Answers
How to have a navmeshagent not move rigidbodies in my world? 0 Answers