Navigate a terrain mesh but not the water

Godot Version

4.2.1

Question

I have a square heightmap which I am using to render a terrain. I also have a plane mesh acting as the sea level and by raising the sea I can create little islands with my terrain. I have a navigation mesh over the terrain which works great - but the problem is that as the terrain still exists under the sea plane mesh - my navigation agents eventually go into the sea!

Is there any way I can reliably ignore the areas of the nav mesh that are under the sea - or is there a way to bake a mesh so that it doesn’t include the sea. Screenshot shows the navmesh and the sea - I want my navmesh to end at the “island” edges

image

Any suggestions appreciated!

A navigation mesh resource is just a two-dimensional mesh with polygon indices. You can procedual change it like any similar mesh by changing the vertices and polygon indices arrays and updating the navigation region with it.

You can rebake a navigation mesh with a baking AABB defined that ends just around your water level. That way source geometry outside this AABB is ignored in the baking process. If you have just an unwieldy terrain mesh that might only performance work while in the editor.

A navigation mesh defines the usable surface. No, there is no “this is usable but also not usable”. You need to remove the mesh parts that are not usable if you dont want it to be used.

Thanks - it would be nice if there were a feature to just paint / unpaint areas that are usable - but I will try the AABB approach as that may be good enough for my needs.

As you suggested adding an AABB filter that is set at my water level was perfect and did exactly what I needed - thanks