The physics
Ride on ship B. In B's frame, B stands still. You move with the relative velocity:
vA, B = vA − vB
That relative path is a straight line. To meet B, it must point straight at B. The closest gap is the perpendicular from B to that line.
t* = −(r₀ · vrel) / |vrel|² dmin = |r₀ + vrel t*|
Two boats in the same current drift together. So you aim straight at a drifting boat.