Physics · function
applyBuoyancy
Apply it, and report whether the body is submerged.
Explained in Your first game, Rigid bodies.
function applyBuoyancy(water: Buoyancy, y: number, state: BuoyantState, dt: number): booleanimport { applyBuoyancy } from '@driftengine/physics';Parameters
| Parameter | Type | Description |
|---|---|---|
water | Buoyancy | |
y | number | Where the body is. Under level is submerged. |
state | BuoyantState | |
dt | number |
Returns Whether it was, so a consumer can count the time or drown somebody — which is a game's decision and not this function's.