Buoyancy Physics

February - March 2022


Source Code

Summary

Description

A buoyancy system for varying shapes inside Unity, built on top of the existing physics system for compatability with other systems.

Technical Side

Each object that can float has a list of points to check if submerged. The floating script checks each of these points individually for how deep below the water they are and applies force towards the surface, scaling with depth below the surface.

Reflection

Only the rigidbody's mass is taken into account. If each buoyancy point of an object had a weight for how much it affects the buoyancy this could improve the overall look and feel of the system.

I am very happy with how this system turned out and may look into integrating it into a future project.

Media