WaterSample
Since 0.7
The water at one point, as {@link WaterHandle.sample} reads it.
Signature
export interface WaterSample {
/** World y of the surface, metres. */
readonly height: number
/** Unit surface normal, `[x, y, z]` (y up). */
readonly normal: Vec3
/** Velocity of the surface water, `[x, y, z]` m/s: the wave's orbital motion, or a river's flow. */
readonly velocity: Vec3
/** Which water holds the point: `"sea"`, `"lake"` or `"river"`. */
readonly kind: WaterKind
}
Import: import type { WaterSample } from "@argus/api"
Members
| Member | Signature | Description |
|---|---|---|
height | readonly height: number | World y of the surface, metres. |
normal | readonly normal: Vec3 | Unit surface normal, [x, y, z] (y up). |
velocity | readonly velocity: Vec3 | Velocity of the surface water, [x, y, z] m/s: the wave's orbital motion, or a river's flow. |
kind | readonly kind: WaterKind | Which water holds the point: "sea", "lake" or "river". |
Example
The tested fixture fixtures/recipes/jump-pad-and-elevator/scenes/behaviors/jump-pad.ts.
import type { Behavior, Vec3 } from "@argus/api"
/**
* A trigger volume that launches whatever walks onto it.
*
* The pad does not reach into the other entity: it says who entered and how hard to launch them,
* and the character's own behaviour calls `ctx.controller.setVelocity`. So one pad works for the
* player, an NPC or a crate with a controller, and a character that should not be launched simply
* ignores the event. The same shape is a knockback volume, a geyser or a car's booster strip.
*/
interface Props {
/** The velocity to give, m/s. Straight up by default. */
velocity?: Vec3
}
export default {
onTrigger(ctx, trigger) {
if (!trigger.entering) return
ctx.events.emit("launch", { target: trigger.other.id, velocity: ctx.props.velocity ?? [0, 9, 0] })
},
} satisfies Behavior<Record<string, never>, Props>