WindHandle
Since 0.7Changed in next
The scene's wind (meta.environment.air.wind) at ctx.time.now: the air the dry probes of buoyancy bodies are dragged against.
A replay reads the same numbers.
Signature
export interface WindHandle {
/**
* The air's velocity at world (x, y, z), `[x, y, z]` m/s: zero in still air or in a scene with no
* `meta.environment.air`. Throws a `RangeError` (`fluid.sample-invalid`) for a coordinate that is
* not a finite number.
*/
sample(x: number, y: number, z: number): Vec3
/**
* Changes the running wind at once; what this does not name stays. False in a scene with no
* `meta.environment.air`. Throws a `RangeError` (`wind.set-invalid`) for a bad argument.
*/
set(wind: { speedMps?: number; directionRad?: number; gustMps?: number; gustPeriodS?: number }): boolean
}
Import: import type { WindHandle } from "@argus/api"
Members
| Member | Signature | Description |
|---|---|---|
sample | sample(x: number, y: number, z: number): Vec3 | The air's velocity at world (x, y, z), [x, y, z] m/s: zero in still air or in a scene with no meta.environment.air. Throws a RangeError (fluid.sample-invalid) for a coordinate that is not a finite number. |
set | set(wind: { speedMps?: number; directionRad?: number; gustMps?: number; gustPeriodS?: number }): boolean | Changes the running wind at once; what this does not name stays. False in a scene with no meta.environment.air. Throws a RangeError (wind.set-invalid) for a bad argument. |
Example
The tested fixture fixtures/recipes/jump-pad-and-elevator/scenes/behaviors/camera-zone.ts.
import type { Behavior } from "@argus/api"
/**
* A trigger volume that retunes the camera while the player is inside it.
*
* The engine has no camera-zone concept and needs none: a volume, a `trigger` component and this.
* Here the player's behaviour owns the camera (it re-sends its params when the view is turned), so
* the zone tells it what to change rather than calling `ctx.camera.set` itself. In a scene where
* nothing else writes the camera, the zone can call `ctx.camera.set(kind, params)` directly.
*/
interface Props {
/** `ctx.camera.set` params to merge in on the way in, and on the way out. */
inside?: Record<string, unknown>
outside?: Record<string, unknown>
}
export default {
onTrigger(ctx, trigger) {
const params = trigger.entering ? ctx.props.inside : ctx.props.outside
if (params) ctx.events.emit("camera-zone", { target: trigger.other.id, params })
},
} satisfies Behavior<Record<string, never>, Props>