- Home /
How do I tell what NavMeshLayer a NavMeshAgent is currently on?
The Agent must know to calculate cost I'm guessing but it isn't exposed anywhere. I thought the NavMesh.Raycast or NavMesh.SamplePosition functions would work but Raycast seems to be intended only for finding obstacles in your path and SamplePosition only finds the joins - so when I'm close to edge it might work, but not when I'm in the middle of that area (depending obviously on the max distance I pass to the sampleposition - but the larger I make that the less useful it becomes).
Basically I have different areas in my world and I thought using the NavMeshLayers would be a simple way of distinguishing them. Is there any way to make this work or should I use a regular raycast into the meshes themselves to see which one I'm on ?
Comment