Skip to content

eulerjs API / @eulerjs/marine / Buoyancy

Buoyancy ​

Defined in: packages/marine/src/Buoyancy.ts:64

Archimedes' principle per cell: each cell under the surface is pushed up by the weight of the water it displaces, at its own position, so a tilted hull is pushed back upright. One instance per body: it remembers each cell's depth between steps.

Implements ​

Constructors ​

Constructor ​

ts
new Buoyancy(options): Buoyancy;

Defined in: packages/marine/src/Buoyancy.ts:88

Parameters ​

ParameterType
optionsBuoyancyOptions

Returns ​

Buoyancy

Properties ​

PropertyModifierTypeDefault valueDescriptionDefined in
angularDragpublicnumberundefined-packages/marine/src/Buoyancy.ts:69
heaveDampingpublicnumberundefined-packages/marine/src/Buoyancy.ts:66
lastForcereadonlyVector3...Sum of the buoyant and damping forces applied on the last step, in world space.packages/marine/src/Buoyancy.ts:76
linearDragpublicnumberundefined-packages/marine/src/Buoyancy.ts:68
minimumAngularDragpublicnumberundefined-packages/marine/src/Buoyancy.ts:71
minimumLinearDragpublicnumberundefined-packages/marine/src/Buoyancy.ts:70
oceanreadonlyOcean<WaveSurface>undefined-packages/marine/src/Buoyancy.ts:65
slamCoefficientpublicnumberundefined-packages/marine/src/Buoyancy.ts:67
submergedFractionpublicnumber0Fraction of the hull's volume under water on the last step, from 0 to 1.packages/marine/src/Buoyancy.ts:74

Accessors ​

voxels ​

Get Signature ​

ts
get voxels(): Voxels;

Defined in: packages/marine/src/Buoyancy.ts:102

The cells the hull is sampled at, once the behaviour is attached to a body.

Returns ​

Voxels

Methods ​

attach() ​

ts
attach(body): void;

Defined in: packages/marine/src/Buoyancy.ts:107

Called by body.addBehavior(behavior).

Parameters ​

ParameterType
bodyBody

Returns ​

void

Implementation of ​

Behavior.attach


fixedUpdate() ​

ts
fixedUpdate(
   body, 
   timestep, 
   world
): void;

Defined in: packages/marine/src/Buoyancy.ts:121

Parameters ​

ParameterType
bodyBody
timestepnumber
worldWorld

Returns ​

void

Implementation of ​

Behavior.fixedUpdate

Released under the MIT License.