Part 2: Buoyancy and Water Dynamics


Eureka!

The buoyant force is what prevents a floating object from sinking as described by Archimedes long before the age of computer simulations.  Time has come to add it to Pirate Sea Jam.

Buoyant Force

The strength of the upthrust is directly proportional to the volume of the fluid that would otherwise occupy the space taken by the object. So to make something apparently float we need to calculate volume of the displaced liquid and push the object in the opposite direction of gravity.

Calculating the volume below the waterline of something like the hull of a ship and accurately applying the resulting buoyant force is not straight forward.  A common simplification is to use several geometric primitives like cubes or spheres that acts as virtual pontoons and attach them around the edge of a main shape, which represents the ship. The buoyant forces of each pontoon act in conjunction on the main shape and ideally make it bob like a boat gently on the sea.

Floating object

Floating wireframe craft with six attached pontoons

Drag force

When simulating buoyancy it's easy to end up with something that looks like an object attached to an invisible spring oscillating up and down around the water surface. To mitigate that problem we need to introduce a drag force, which is a damping force for objects that move through fluids. The drag force is proportional to the square of the velocity. In other words when the speed is doubled the drag force is increased fourfold. The size and the shape of an object also affect the damping. 

Usually you have to fine tune the magnitude of the buoyant and drag forces to make your craft float somewhat realistically, but once you have a configuration that works, pump your fist in the air and exclaim "Eureka!"

Next up

Next up is to dress the wire frame in a nice 3D model.

Ship ahoy!

Get Pirate Sea Jam

Leave a comment

Log in with itch.io to leave a comment.