Water Volume
Updated
Lets the camera go under this water: water-coloured fog as far as its clarity, the waves seen from below, drifting specks.
- Type
comp-water-volume- Script class
WaterVolumeComponent- Per entity
- One
- Version
- 1.2.0
Read about it in Water: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
clarity |
15 |
1 ≤ x ≤ 100 |
depth |
20 |
0. |
particles |
0.5 |
0 ≤ x ≤ 1 |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
WaterVolume::enterWaterVolume::submergeWaterVolume::emergeWaterVolume::exit
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
A garden pool of clear water: caustic light dances on its tiled floor, the walls are wet at the waterline, a beach ball bobs with foam round it, and a Water Volume lets the camera go under the surface.
Drag to orbit round the pool. Scroll in to dive under the surface: the water fogs the view, bubbles drift past and caustics play on the floor. Scroll out to come back up.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(WaterVolumeComponent); if (component) log(component.props);}