Overlapping NavigationRegions on the same layer won't merge and prevents travel cost changes

Godot Version

v4.7.stable

Question

I am trying to have overlapping navigation regions of the same layer connect with one another but it doesn’t merge the overlapping regions. For more context, I have a sea, a navigation region that has a travel cost of 2 (since it would slow down the agent), containing a ship, another region with a travel cost of 1. I nested it so that an agent can travel from anywhere in the sea towards the ship. It’s something like this.

The problem I am facing is that if I only nest the ship’s navigation region with the sea’s, it would not consider the ship’s lower travel cost and only path a straight line towards the target inside the ship instead of the path of least time.

One workaround that I found is making a hole in the sea’s region and lowering the agent radius to 0 for both of the regions (It would be hard to manually line up the regions by hand) to connect the regions so that it would travel the predicted path. However, now when it ever reaches a corner, the agent would struggle to path around it and it will slide against the wall or get stuck.

How do I make it so that the agent still follows the predicted path while also having the region’s agent radius not be zero?

Overlapping regions don’t merge. Nesting the ship inside the sea just leaves the sea mesh covering that area, so the path stays on cost 2 and goes straight. Docs say the same, overlap isn’t enough. Regions need a shared edge. (Connecting navigation meshes — Godot Engine (stable) documentation in English)

Do the hole approach, but don’t zero the agent radius. Cut a hole in the sea polygon that matches the ship outline then put the ship region in that hole with no overlap and make the hole edge and ship edge line up (same verts, or within edge_connection_margin). Keep a normal agent radius on both, and bake both polygons with that same radius.

If corners get sticky, bump navigation/2d/default_edge_connection_margin a bit instead of setting radius to 0. radius 0 is what makes agents clip/slide on corners.

travel_cost only matters once the path actually crosses into the other region. Until those edges connect, the cheaper ship mesh never gets used.