Tidal 2 URP

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

  1. The object needs a Rigidbody (the component requires one).
  2. Add Component > TidalBuoyancy; set Connected Rigid.
  3. Add four or more empty children at the hull’s bottom corners and assign them to Float Points.
  4. Size Buoyancy Factor to the mass: about mass / FloatPoints.Length * 2.

In the editor

Tidal Buoyancy inspector

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.

Island pirate sloop selected in the Scene view

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.

Buoyancy on the island sloop

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.

Sloop under way with its wake

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.

Sloop from above

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.

Sloop close up

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

FieldDefaultMeaning
Buoyancy Factor5Lift 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 Depth1Depth at which a point’s lift is full
Waterline Offset0.3Shifts the float line relative to the points
Center Of Mass Offset(0,-0.5,0)Lower = harder to capsize
Roll / Pitch Damping1Settles rocking
Flow Follow11 = drifts at the current’s speed at any mass; 0 = still-water drag
Flow Push Strength350Extra grip toward the current, N per m/s
Keel Effect00-1. Extra drag on water crossing the hull (up to 10x Water Drag). ~0.5-1 for boats, 0 for crates
Ignore Own WakeonFloats without sinking into its own wake dimple
Ride Under CurlsoffUnder a breaking wave box curl, float on the face below instead of the lip above
Wave Carry1With 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

SymptomCauseFix
Object sinksBuoyancy Factor too low for the massmass / points * 2
Object rockets out of the waterFactor far too highLower it
CapsizesCentre of mass too highLower Center Of Mass Offset Y
Slides sideways in currentsNo keelKeel Effect 0.5-1
Does not drift with a currentFlow Follow 0 or zone is DampingFlow Follow 1; use a Flow zone
Sits in a hole at its own positionOwn wake countedIgnore Own Wake on
Floats on the hull’s interior volumeVolume not ignoredAdd it to Ignore Volumes