What happens to a navagent above overlapping navmesh-surfaces?

Sorry Guys, a dumb question, but I simply cannot figure out the issue here:

I have a simple object with a navmesh agent attached to it. On the ground there is the regular terrain and 2 quads (having baked surface brown and surface green). The navmesh agent gets a waypoint and moves straight to the destination, although he should ignore surface green:


Actually the agent should use the red path around the green nav surface. The green nav surface slightly overlaps the brown one. Before the waypoint is assigned the navagent areacost was lifted to 9999 for the green surface so that he avoids it. The areamask is at -1 (all).

Height levels:

  • terrain = 10.498
  • brown surface = 10.50
  • green surface = 10.55
  • navmesh agent when crossing = 10.78 (manually height adjusted to be on top)

Agent type is matching of course and using the standard agent settings:
image

Doing a NavMesh.SamplePosition obviously recognizes the 3 surfaces once on it, but no effect on movement. Also tried to exclude the green one from the areamask, but it seems also here the next lower one (the brown one) is obviously taken. But no way to exclude the green.

Any help would be appreciated!

PS.: the actual idea here was to calculate navmesh surfaces, and depending which unit type gets a path, some may pass, some may not move through.

Hi! It is not clear from your message if you’ve baked just one NavMesh Surface or multiple (one for each quad). The NavMesh Agent attaches to just one NavMesh and does not take into account other Surfaces when moving. If you assign a NavMesh Modifier component to the green quad and Override the Area Type, then, the single NavMesh that you bake will take the different area types into account, and then I’d expect the agent to avoid the green area. The area type you assign to the green quad needs to have a higher index (in the Areas list) than the area type you assign to the brown quad.

As a side note, it’s recommended to use area costs of similar magnitude, in order to avoid the pathfinding algorithm to do a more extensive search for the lowest-cost path. So it’s best if the green area gets a cost of 3, 5 or 10 times higher than the other areas It’s probably not necessary for it to be 100-1000 times higher.