3D Boat Physics

illustration showing sailboat in tropical sea

In a Nutshell

When an object is submerged in a fluid, it displaces the surrounding fluid. This displacement results in the elevation of the fluid around the object. As the fluid is lifted against gravity, it gains potential energy. The source of this potential energy is the work done by the object in displacing the fluid.

Now, according to Archimedes’ principle, this gain in potential energy is balanced by an equal and opposite force acting on the object, known as the buoyant force. In essence, the buoyant force is a manifestation of the potential energy stored in the displaced fluid. When this potential energy equals the weight of the object, the system reaches equilibrium, and the object floats.

Mathematically, Buoyant force B = fluid_density x displaced_volume x g

Forces on a Boat

buoyancy, thrust, drag & weight on a boat

Similar to aerodynamics, there are four main forces acting on a moving ship.

Weight

Weight due to gravity acts downward & is equal to W = mg. To apply in a game, you add (mass x vec3(0, -9.8, 0)) to your forces.

Buoyancy

It is an upward force, while good discussion is already done about it, here I rewrite its formula:

B = fluid_density x displaced_volume x g

To apply in a game, you add (B x vec3(0, 1, 0)) to your forces.

Drag

When boat has some velocity, it experiences a drag force against its movement direction. This drag force is greater if density, area or velocity is greater. It is in fact a complex calculation, but here very general approximation is given:

Drag force D = 0.5 x Cd x object_cross_section_area x fluid_density x object_velocity^2

where Cd is drag coefficient (a constant).

To apply in a game, add this force opposite to velocity: D x normalized(-velocity)

Push

Boats or ships need some push from engines or sails. It can be added in any way in a game, based on user input. Keep in mind that a thrust force not directly acting on boat’s center of gravity can result in torque (which can cause tilt, just like in sailboats in reality).

Displaced Volume Calculation

In buoyancy above, we talked about displaced_volume. The volume of fluid displaced by the object is often complex to calculate due to object’s structure. Thus we end up approximating it in games. Assuming a cube, if it is submerged fully, the displaced volume will be the volume of cube, but if it is partially submerged, then the displaced volume will only be the part which penetrates the surface of fluid.

Rotation & Maneuvering

In case of sailboats, you need to approximate the forces due to sails. These forces result in thrust & some torque. Together with other forces from ocean waves, drag, wind and so on causes goo boat movements.

Also, in case of arcade-style rotation, only rotation added based on user input is sufficient. However, for more realistic motion, you may want to introduce rudder vector that changes direction based on user input & all drag and steering forces are calculated based on relation with rudder vector.

Related posts

  1. airplane physics

More reading

I have covered basics of boat physics. I aim to improve this post & add more details. Also, it will be a good idea to share links to good resources once I find them.

Table of Contents