Find position of island’s shoreline

I need to generate a gameobject just outside an island, in the water. For simplicity let’s assume they’re all mostly circular with no loops, inner bodies of water, or parts that curve around.

I know the Y height of the water (0 in world space), and I know the position of the islands.

But I don’t know how far each part of the island extends from the centre.

Based on that, what would be an efficient way of getting the position of a random outermost point of the island that lies on Y 0?

First I thought about casting a ray from the island outwards, but I have no idea if it’s possible to check when a ray exits a collider it started inside of, and so far I haven’t found anything online.

No but you can do it the opposite way with the ray traversing the opposite direction starting at a significant distance at least the distance of the Collider bounding box.

1 Like