Appearance
@bendyline/molen-kernel/boats
Molen headless deterministic simulation kernel (no DOM, no three.js).
ts
import { /* … */ } from '@bendyline/molen-kernel/boats';Interfaces
BoatEnvironment
Properties
boostMode?
ts
optional boostMode?: boolean;Override the world's boost mode. Buoyancy and helm response keep their normal timing.
conditions?
ts
optional conditions?: WaterSettings;time?
ts
optional time?: number;Methods
canOccupy()?
ts
optional canOccupy(
position,
yaw,
spec,
id
): boolean;Parameters
position
[number, number, number]
yaw
number
spec
BoatSpec
id
string
Returns
boolean
waterAt()
ts
waterAt(x, z): WaterSample | null | undefined;undefined = unloaded; null = dry land; never infer water merely from low terrain.
Parameters
x
number
z
number
Returns
WaterSample | null | undefined
WaterSample
Mean surface height and optional measured depth/current. Omit depth for DEMs without bathymetry.
Properties
current?
ts
optional current?: [number, number];depth?
ts
optional depth?: number;height
ts
height: number;Variables
Boat
ts
const Boat: ComponentType<BoatData>;BoatInput
ts
const BoatInput: ComponentType<BoatInputData>;BoatState
ts
const BoatState: ComponentType<BoatStateData>;IDLE_BOAT_INPUT
ts
const IDLE_BOAT_INPUT: BoatInputData;Water
ts
const Water: ComponentType<WaterSettings>;Functions
boatSupport()
ts
function boatSupport(
env,
x,
z,
yaw,
spec
): object;Check the hull footprint, not just its center, against coastlines and known shallow water.
Parameters
env
x
number
z
number
yaw
number
spec
BoatSpec
Returns
object
grounded
ts
grounded: boolean;sample?
ts
optional sample?: WaterSample;waiting
ts
waiting: boolean;driveBoat()
ts
function driveBoat(
world,
actor,
input
): boolean;Parameters
world
actor
string
input
BoatInputData
Returns
boolean
initialBoatState()
ts
function initialBoatState(yaw?): BoatStateData;Parameters
yaw?
number
Returns
BoatStateData
installBoats()
ts
function installBoats(world, env): void;Parameters
world
env
Returns
void
sampleWaves()
ts
function sampleWaves(
settings,
x,
z,
seconds
): object;Analytic swell displacement and slopes; deterministic, stateless and replayable.
Parameters
settings
WaterSettings
x
number
z
number
seconds
number
Returns
object
height
ts
height: number;slopeX
ts
slopeX: number;slopeZ
ts
slopeZ: number;stepBoat()
ts
function stepBoat(
t,
state,
input,
spec,
dt,
env,
id?
): object;Powered displacement/planing approximation; no road brakes or tire physics.
Parameters
t
state
BoatStateData
input
BoatInputData
spec
BoatSpec
dt
number
env
id?
string
Returns
object
state
ts
state: BoatStateData;transform
ts
transform: TransformData;