You could simply add this as a layer atop the navmesh agent (well, under, as this would be done via child game objects). Basically, you let you nav mesh agent move around on a flat plane, while your boat, as a child object, moves up and down with the level of the water. You’ll probably want to do this regardless of AI solution.
Though I don’t know if some fancy AI navigation is needed here. Assuming these boats just want to come alongside the player to shoot them with broadside cannons, it’s kind of like a missile, only aiming for a position beside the target rather than the target itself.
You work out a position beside the player, and it continues to move forwards, turning at a certain speed, trying to maintain a direction that points itself towards the target.
Ok, so if I understand correctly, a simple script to control the enemy boat should be good enough?
I forgot to add that there may be some small obstacles in the game scene - maybe a couple of floating barrels here and there, nothing that would require A star search. It would be great for the enemy to avoid those obstacles, but nothing will happen if the enemy occasionally hits an obstacle. Also, the player can “hide” behind an obstacle - it’s not possible to shoot through obstacles.
It’ll be a good, simple starting point, that’s for sure. And then you have a basis from which to improve.
Knowing a boats velocity and its turning speed, you can roughly plot its projected heading over time. This can be used to make a series of points, with which can be used to query whether anything is in the way.
Then you can manipulate the plotted path based on obstacles to plot a path around them, and have the ship follow this path. Which I realise is starting to sound more like a proper AI navigation system.
This is just raycasts or other queries from the enemy to the player to determine whether anything is in the way.
Ok thank you, that gives me a starting point.
I think I will stick with that “missle” approach as you mentioned and maybe add something on top of that to avoid obstacles later.
I also found a cool video describing how to make a very simple vehicle AI using existing vehicle controller, so I am going to leave it here: https://www.youtube.com/watch?v=xuCtxIcfboM&t=1s