DEVELOPMENT LOG NO. 15

Ocean Tech: 2D Surface Pools

Oceans have been giant empty pits to avoid ever since I went from circle worlds to curved surfaces in the first dev log. Tackling it went way better than I'd feared.

Not one to reinvent the wheel when I have a million wheels I have to invent, I found a Unity Store asset called Water Waves 2D. In this package was a circle water solution.

This asset takes a collision and gives the closest vertex a velocity that it then propagates out across the vertexes neighbors. The velocity is used to calculate a position offset and cause the vertices to rise and fall as the velocity spreads out and springs up and down.

wave circles

I first added one of these circle wave assets to my worlds, loved how the wave mechanics worked and had a great start. I just needed to fix them up to look better for an ocean and not take up an entire world. It didn't take too long to just cut out a semicircle from the assets custom built mesh solution.

cut out section of wave circle

From there I came up with a simple solution where I would take two parameters, an angle that is inside the pool I'm filling and a radius of the water level.

water component inspector

From there I could fit the water to the bottom of the pool and follow the curve of the world across the top. Here you can see the outline taking shape.

water vericies

I then feed that hull of vertices to an ear clipping algorithm that calculates a shape filling set of triangles. I then color the vertices before finally using all this data to construct a custom mesh.

custom surface pool mesh

Then I set up the collisions, added some sound effects, wrote a script to add an upwards force to objects that are submerged and at last the oceans are filled.

Next Star Over logo

© All Rights Reserved Next Star Over 2026