Movement in islands/ocean scenario?

Hi, sorry to bother you with a very specific problem - I would totally get it, if you don’t have time to answer it. But let me try my luck nonetheless and present you the challenge I’m facing.

I’m working on an RTS and have 2 mayor unit types: infantry and ships. The scenes consist of several islands that are separated by the ocean (pirate setting).

Ships can only move on deep water. I created a plane that is 4m below the ocean surface and added it to a recast “ship” graph. I set slopes to 0, and a big agent radius, so that my ships cannot approach islands too much, and added some custom movement script:

That works pretty well so far.

Now the first real challenge. I want my units to be able to move from one island to another one. They should spawn a boat when near the shore, jump in, the boat moves across the ocean and at the other islands shore, they should dump the boat and continue walking.
I identified 2 options:
A) using one graph only, so my units are free to move. They do a raycast against the ground frequently and if they touch water, they spawn the boat. This however comes at a cost:

  • I’d like to give a penalty to the ocean, so my units try to avoid it if possible. As the world is large and changes (buildings are placed, walkable walls etc), I guess I have to use a recast graph. Can I assign penalties to one part (the ocean) in this case? Maybe by layer or tag or something?
  • I’d like to spawn the boat a bit before they touch water. I’d thought about querying the pathfinding nodes to identify the last node that is on terrain and spawn it there. But it seems unreliable, as this node might be far away from the shore.
  • My boats need to use a different movement script (physics based like my ships do). So I have to share paths between the 2, which is tricky.

B) I played around with 2 recast graphs: Terrain graph and boat graph. They do, what the name suggest.

This approach seems more straight forward, but even though they are overlapping, my agents cannot cross from one graph to the other (they have assigned both graphs in the seeker). Is cross-graph pathfinding not possible?

Do you have any suggestion or recommendations what the best approach is?