Repository navigation
API Class WaterSurface
Defined in: src/engine/render/water/WaterSurface.ts:52
A moving water surface: a square grid of size world units centred on its node, in the node's
XZ plane, displaced by up to 8 Gerstner waves. sample(x, z) (and Water.sample) returns the
height and normal of the drawn surface, for buoyancy and gameplay.
Keep the node level (turn it about Y only): sampling assumes the water's up is the world's.
new WaterSurface(): WaterSurface;WaterSurface
contactFoam: number = 0.4;Defined in: src/engine/render/water/WaterSurface.ts:102
Foam where things not in the shore map (hulls, moving bodies) meet the water, within this many metres of the scene's depth (ADR 0663 §2; 0: none). Medium and high water quality only.
deepColor: Color;Defined in: src/engine/render/water/WaterSurface.ts:62
Colour looking straight down into the water and in troughs.
depthMap: string = "";Defined in: src/engine/render/water/WaterSurface.ts:93
The baked shore map (ADR 0663 §2, asset kind "waterDepth"): the depth to the ground and the distance to the shore over the surface, and the wall points waves throw spray off. It makes waves shoal and break into surf, lays foam along shores and makes wake ripples bounce off walls. Made by the inspector's "Bake shoreline"; empty: open water.
farWakes: boolean = true;Defined in: src/engine/render/water/WaterSurface.ts:87
Draw wakes beyond the field as trails along their sterns' paths (ADR 0459's far LOD; how many: the water quality's
farWakes). Off, wakes end at the field's edge. The World's first enabled surface decides it, as with interaction.
foamAmount: number = 0.5;Defined in: src/engine/render/water/WaterSurface.ts:67
0 (none) to 1: how readily foam forms where crests fold.
foamColor: Color;Defined in: src/engine/render/water/WaterSurface.ts:65
impactEffect: string = "";Defined in: src/engine/render/water/WaterSurface.ts:106
The particle effect played where waves strike a wall or a hull (ADR 0663 §3); empty: the engine's own spray.
interaction: WaterInteraction = "auto";Defined in: src/engine/render/water/WaterSurface.ts:82
How much the water reacts to what is in it (ADR 0663 §4): the wake field around the camera that WaterWake hulls
and moving bodies press into, splash and impact spray, and contact foam. "auto" follows the graphics tier's water
quality; "low", "medium" and "high" fix it; "off" turns them all off. The World's first enabled surface decides it
for every surface. Shoaling and shore foam from depthMap don't follow it: buoyancy mustn't change with settings.
(Replaces ADR 0459's wakeMode; older scenes load "off" as "off" and its other values as "auto".)
normalDetail: number = 0.5;Defined in: src/engine/render/water/WaterSurface.ts:69
Strength of the scrolling ripple normals on top of the waves (0 = none).
opacity: number = 1;Defined in: src/engine/render/water/WaterSurface.ts:72
Below 1 the surface is drawn transparent.
reflectivity: number = 0.5;Defined in: src/engine/render/water/WaterSurface.ts:74
Strength of the Fresnel reflection of the environment (0–1).
resolution: number = 128;Defined in: src/engine/render/water/WaterSurface.ts:56
Vertices per side (2–1024). Quality tiers with the "low" shader level use half.
roughness: number = 0.08;Defined in: src/engine/render/water/WaterSurface.ts:70
shallowColor: Color;Defined in: src/engine/render/water/WaterSurface.ts:64
Colour at grazing angles and on crests.
shoreFoam: number = 1.5;Defined in: src/engine/render/water/WaterSurface.ts:97
Foam along the shore line, out to this many metres from it (ADR 0663 §2; 0: none). Needs depthMap.
shoreResolution: number = 256;Defined in: src/engine/render/water/WaterSurface.ts:95
Texels per side of the shore map when it is baked (ADR 0663 §2).
size: number = 100;Defined in: src/engine/render/water/WaterSurface.ts:54
Side of the square grid, in the node's local units.
splashEffect: string = "";Defined in: src/engine/render/water/WaterSurface.ts:104
The particle effect played where something falls into the water (ADR 0663 §3); empty: the engine's own splash.
waves: WaterWave[];Defined in: src/engine/render/water/WaterSurface.ts:58
Up to 8 waves: direction (degrees, 0 = +X), wavelength, steepness 0–1, speed (0: deep-water speed; negative: backward).
waveScale: number = 1;Defined in: src/engine/render/water/WaterSurface.ts:60
Multiplies every wave's amplitude; raise it at runtime for a storm.
get enabled(): boolean;Defined in: src/engine/core/Component.ts:63
boolean
set enabled(value): void;Defined in: src/engine/core/Component.ts:67
boolean
void
get gameObject(): GameObject;Defined in: src/engine/core/Component.ts:43
Unity-style alias for node.
get isActiveAndEnabled(): boolean;Defined in: src/engine/core/Component.ts:74
True when enabled, the node is active in the hierarchy, and the node is in a loaded world.
boolean
get node(): GameObject;Defined in: src/engine/core/Component.ts:38
The node this component is on.
get owner(): GameObject;Defined in: src/engine/core/Component.ts:51
The node this component acts for: the node itself when attached directly, or the parent node when this component lives on a component node (ADR 0009).
get time(): Readonly<TimeState>;Defined in: src/engine/core/Component.ts:99
This component's World's clock (ADR 0032): the same values as Time, but safe to read
outside the World's frame too (after an await, say).
Readonly<TimeState>
get transform(): Transform;Defined in: src/engine/core/Component.ts:57
The Transform of the node this component is on, if it has one.
get world(): WorldHandle;Defined in: src/engine/core/Component.ts:88
A handle on this component's World (ADR 0132): the same one Engine.findWorld returns. Load
a scene into it, pause, connect or destroy it: this.world.loadScene("scenes/level2.scene.json").
Throws for a World no Engine owns.
instantiate(prefabPath, options?): GameObject;Defined in: src/engine/core/Component.ts:109
Instantiate a prefab in this component's World (ADR 0034), like GameObject.instantiate.
Use it in code that may run after an await: by then the frame is over and the current World
is the Engine's default one, which may not be this component's. A parent from another
World throws.
string
InstantiateOptions = {}
sample(x, z): WaterSample;Defined in: src/engine/render/water/WaterSurface.ts:144
The surface's height and normal at world (x, z), at the water clock's current time: the same
waves, waveScale and time the renderer draws, with the waves' sideways motion undone. The
waves continue past the edge of the drawn grid.
number
number
This wiki is generated from docs/wiki/ and the myco module's source on every push to master. Change pages there in a pull request: edits made here are not kept.
Basics
Gameplay
Rendering
Audio
- Playing sound
- Why is there no sound?
- Playlists
- Interactive music
- Sound generators
- Spatial audio
- Audio mixer
- Live mixing
- Loudness
- Audio profiler
- Audio takes
Reference