Skip to content

Documentation / scene / WaterDisturber

Class: WaterDisturber

Defined in: libs/scene/src/render/water_interaction.ts:93

Something that disturbs a water surface by moving through it.

Follows a scene node and describes the volume the node occupies with one of three shapes. Each frame the field works out how much water column the shape displaces at every texel - its footprint on the surface, weighted by how deep it sits - and injects the change since the previous frame. Something at rest therefore leaves the water alone; something moving pushes water down ahead of itself and lets it back up behind, which is what a wake is; something dropping in pushes down all over its footprint at once.

A blocking disturber is also an obstacle: waves stop at its footprint and reflect off it, the way ripples do off a piling.

Constructors

Constructor

new WaterDisturber(node?, shape?): WaterDisturber

Defined in: libs/scene/src/render/water_interaction.ts:130

Creates a disturber.

Parameters

node?

SceneNode = null

Node the shape follows.

shape?

WaterDisturberShape = 'sphere'

Footprint shape. Defaults to sphere.

Returns

WaterDisturber

Properties

node

node: SceneNode

Defined in: libs/scene/src/render/water_interaction.ts:95

Node the shape follows, or null until nodeId has been resolved.


nodeId

nodeId: string

Defined in: libs/scene/src/render/water_interaction.ts:101

Persistent id of the node the shape follows, for a disturber loaded from a scene before the node it refers to exists. Resolved against the water's scene on the next update; node wins when both are set.


shape

shape: WaterDisturberShape

Defined in: libs/scene/src/render/water_interaction.ts:103

Footprint shape.


radius

radius: number

Defined in: libs/scene/src/render/water_interaction.ts:105

Radius in metres, for sphere and capsule. Scaled by the node.


halfLength

halfLength: number

Defined in: libs/scene/src/render/water_interaction.ts:107

Half the segment length in metres, for capsule, along the node's local Y axis.


size

size: Vector3

Defined in: libs/scene/src/render/water_interaction.ts:109

Extents in metres, for box, along the node's local axes.


strength

strength: number

Defined in: libs/scene/src/render/water_interaction.ts:114

Water column displaced by the fully submerged shape, in metres of surface height. Scales how hard the disturber pushes; not a physical volume.


blocking

blocking: boolean

Defined in: libs/scene/src/render/water_interaction.ts:116

Whether waves stop at and reflect off the footprint.


enabled

enabled: boolean

Defined in: libs/scene/src/render/water_interaction.ts:118

Whether the disturber is taken into account.

Released under the MIT License.