Buoyancy (floating objects)
What it is
TidalBuoyancy makes a Rigidbody float on Tidal water. It samples the water at a set of
float points, pushes each up by how deep it is, applies water/air drag, drifts with currents
and can resist sideways sliding like a keel. It reads the same GPU-baked surface that is drawn,
so objects sit exactly on the visible waves (including wave boxes and whirlpools).
How to add it
- The object needs a
Rigidbody(the component requires one). Add Component > TidalBuoyancy; set Connected Rigid.- Add four or more empty children at the hull’s bottom corners and assign them to Float Points.
- Size Buoyancy Factor to the mass: about
mass / FloatPoints.Length * 2.
In the editor
Screenshot: the Tidal Buoyancy component. References - Connected Rigid, Using Tidal Body (both None until assigned; empty body = first body found). Float Points (0) and Ignore Volumes (0) lists, Ignore Own Wake (on), Ride Under Curls (off), Wave Carry 1. Buoyancy - Max Submerge Depth 1, Waterline Offset 0.3, Buoyancy Factor 5. Stability - Center Of Mass Offset (0, -0.5, 0), Roll Damping 1, Pitch Damping 1. Drag - Air Drag 0.1, Air Angular Drag 0.05, Water Drag 1.5, Water Angular Drag 1. Flow - Flow Push Strength 350, Flow Follow 1, Keel Effect 0. Wave Slide - Wave Slide Strength 1, Wave Slide Sample Dist 1.5.
Screenshot (Scene view, Demo_Island): the pirate sloop playerShip selected, sitting in a
shallow lagoon beside a sandy island with a wooden jetty. Its hull is tinted red/orange - the
TidalVolumeSDF gizmo showing the baked hull shape that keeps water out of the boat - inside a
cyan wire box (the volume’s bounds). Thin wire ellipses around the hull are the wake emitter
gizmos, and a small yellow sphere marks a float point.
Screenshot: the Tidal Buoyancy component on that sloop, a real tuned setup: Connected
Rigid playerShip, Using Tidal Body TidalBody (Ocean), 7 Float Points, 1 Ignore Volume
(its own hull SDF), Ignore Own Wake on. Max Submerge Depth 4.3, Waterline Offset 0.08,
Buoyancy Factor 120, Center Of Mass Offset (0, -8, 0), Air Drag 0, Water Drag 1.5, Flow Push
Strength 350, Flow Follow 1. Blue bars on the left mark values overridden in the scene.
Screenshot (Game view, Demo_Island): the pirate sloop sailing bow-first away from the camera across deep blue open sea, its raised stern deck nearest the viewer, leaving a broad white foam wake that spreads back toward the camera.
Screenshot (Game view, Demo_Island): straight down on the sloop sailing up the image: bowsprit and spread sail at the top, wooden deck in the centre, and two white foam trails streaming back from the stern in a narrow V.
Screenshot (Game view, Demo_Island): a close, low view from ahead and to one side of the sloop riding the swell - wooden hull with a teal stripe, sail and rigging, raised aft deck - with a foam wake behind it and a sandbar on the horizon.
Settings
| Field | Default | Meaning |
|---|---|---|
| Buoyancy Factor | 5 | Lift force per point (x 9.81 N), NOT scaled by mass. 4 points x 5 carries ~20 kg. Use mass / points * 2 to ride half-submerged |
| Max Submerge Depth | 1 | Depth at which a point’s lift is full |
| Waterline Offset | 0.3 | Shifts the float line relative to the points |
| Center Of Mass Offset | (0,-0.5,0) | Lower = harder to capsize |
| Roll / Pitch Damping | 1 | Settles rocking |
| Flow Follow | 1 | 1 = drifts at the current’s speed at any mass; 0 = still-water drag |
| Flow Push Strength | 350 | Extra grip toward the current, N per m/s |
| Keel Effect | 0 | 0-1. Extra drag on water crossing the hull (up to 10x Water Drag). ~0.5-1 for boats, 0 for crates |
| Ignore Own Wake | on | Floats without sinking into its own wake dimple |
| Ride Under Curls | off | Under a breaking wave box curl, float on the face below instead of the lip above |
| Wave Carry | 1 | With Ride Under Curls: how strongly the wave’s water carries the hull |
| Ignore Volumes | - | Volumes (e.g. the hull’s own Exclude volume) the floater should not see |
Bundled boats
Assets/Tidal 2/Demo/3D/ contains ready prefabs: CorsairSloop_Exterior / _Interior (pirate
sloop), Battleship, AircraftCarrier (NavalFleet) and WakeboardBoat. Each has
buoyancy, Keel Effect 0.7, propellers (BETA), and bow + stem wake emitters already set up.
Scripting
var rb = boat.GetComponent<Rigidbody>();
var buoy = boat.AddComponent<TidalBuoyancy>();
buoy.ConnectedRigid = rb;
buoy.UsingTidalBody = body; // null = first body found
buoy.FloatPoints = myFourCornerTransforms;
buoy.BuoyancyFactor = rb.mass / buoy.FloatPoints.Length * 2f;
buoy.CenterOfMassOffset = new Vector3(0f, -0.5f, 0f);
buoy.FlowFollow = 1f;
buoy.KeelEffect = 0.7f;
bool afloat = buoy.IsInWater;
// Custom floaters: read the surface yourself
float h = body.GetWaterHeight(p); // float.MinValue = no water here
if (body.TryGetWaterSurface(p, out float height, out Vector3 normal)) { }
Vector2 current = body.GetWaterFlow(p); // world XZ, m/s
float submerged01 = body.GetSubmersion01(p, 0.5f);
float ownWake = body.GetOwnWakeHeight(p, rb); // subtract to ignore your own wake
Under a breaking curl GetWaterHeight returns the top surface (the lip). Use
TryGetWaterColumn / TryGetWaterSurfaceBelow there - see Scripting API Reference.
Common issues
| Symptom | Cause | Fix |
|---|---|---|
| Object sinks | Buoyancy Factor too low for the mass | mass / points * 2 |
| Object rockets out of the water | Factor far too high | Lower it |
| Capsizes | Centre of mass too high | Lower Center Of Mass Offset Y |
| Slides sideways in currents | No keel | Keel Effect 0.5-1 |
| Does not drift with a current | Flow Follow 0 or zone is Damping | Flow Follow 1; use a Flow zone |
| Sits in a hole at its own position | Own wake counted | Ignore Own Wake on |
| Floats on the hull’s interior volume | Volume not ignored | Add it to Ignore Volumes |