Skip to content

Interface: BodyLiquid

Surface liquid controls — no-ops on bodies without liquid configured (dry rocky, metallic, gaseous, stars).

Methods

setSeaLevel()

ts
setSeaLevel(worldRadius): void;

Sets the world-space radius of the liquid surface sphere.

Parameters

ParameterType
worldRadiusnumber

Returns

void


setVisible()

ts
setVisible(visible): void;

Toggles the liquid surface visibility.

Parameters

ParameterType
visibleboolean

Returns

void


setOpacity()

ts
setOpacity(alpha): void;

Sets the liquid surface alpha in [0, 1].

Parameters

ParameterType
alphanumber

Returns

void


setColor()

ts
setColor(color): void;

Live-patches the liquid surface tint without rebuilding the body. Substance-agnostic — the caller resolves the chemistry (h2o, ch4, nh3, …) and pushes the resolved colour through. No-op on dry / frozen bodies.

Parameters

ParameterType
colorColorRepresentation

Returns

void


getRaycastState()

ts
getRaycastState(): 
  | {
  mesh: Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material<MaterialEventMap> | Material<MaterialEventMap>[], Object3DEventMap>;
  faceToTileId: readonly number[];
}
  | null;

Resolves the liquid shell's raycast target — mesh is the merged water cap, faceToTileId[i] returns the tile id of the i-th triangle. Returns null on dry / frozen bodies (no shell built). Lets callers raycast against the water surface and identify which submerged tile sits under the pointer.

Returns

| { mesh: Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material<MaterialEventMap> | Material<MaterialEventMap>[], Object3DEventMap>; faceToTileId: readonly number[]; } | null

Distribué sous la licence indiquée dans le dépôt.