NavMesh.FindClosestEdge issue

Updated on April 23, 2019 in [A] Unity Scripting
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
2 on April 23, 2019

Hi everyone,

The method NavMesh.FindClosestEdge seems to be highly unreliable. When used, most times it returns the correct closest Navmesh edge relative to the game object of interest. However, sometimes it does not work. If you see the picture below, the red arrow represents the game object relative to which the closest Navmesh edge should be found, while the blue arrow shows the position returned by NavMesh.FindClosestEdge(): this is definitely not the closest Navmesh edge.

 

findclosestedge_notworking.JPG

  • Liked by
Reply
0 on April 23, 2019

Does this inconsistency only occur when the object is already close to the edge of the mesh?

The edge could be inside some minimum distance that the check ignores, and it is instead finding the next closest edge.

  • Liked by
Reply
Cancel
0 on April 23, 2019

Mmn good question. The documentation does not mention anything as usual.. I guess I’ll have to find a way to check.

It seems to occur randomly actually. Sometimes it does, sometimes it doesn’t, regardless of where the object is placed.

  • Liked by
Reply
Cancel