RoadStanding
Since 0.7
One row of {@link RoadLine.standings}.
Signature
export interface RoadStanding {
/** The tracked entity. */
readonly entity: EntityHandle
/** Its scene id. */
readonly id: string
/** 1 for the leader. Ties go to whoever reached that distance first. */
readonly place: number
/** Laps completed, as {@link RoadProgress.lap}. */
readonly lap: number
/** Race distance, m, as {@link RoadProgress.distance}. */
readonly distance: number
}
Import: import type { RoadStanding } from "@argus/api"
Members
| Member | Signature | Description |
|---|---|---|
entity | readonly entity: EntityHandle | The tracked entity. |
id | readonly id: string | Its scene id. |
place | readonly place: number | 1 for the leader. Ties go to whoever reached that distance first. |
lap | readonly lap: number | Laps completed, as {@link RoadProgress.lap}. |
distance | readonly distance: number | Race distance, m, as {@link RoadProgress.distance}. |
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>