PlayerProps
Since 0.6
Signature
export interface PlayerProps {
/** Metres per second; overrides the `controller` component's `speed`. */
speed?: number
/** Jump strength; overrides the component's `jump`. Meaning is the Rust controller's. */
jump?: number
/** Multiplier on speed while crouched. */
crouchSpeedScale?: number
/** Multiplier on speed while the `sprint` action is held (unbound by default). */
sprintScale?: number
/** Hold to stay crouched, or press to toggle. */
crouchMode?: "hold" | "toggle"
/** Only jump when the controller reports it is grounded. */
requireGrounded?: boolean
/**
* Move relative to the camera's heading rather than world axes. Read only when this behavior owns the
* controller (`input: "script"`); under `auto` the component's `inputBasis` decides, for the engine and
* for this behavior alike.
*/
cameraRelative?: boolean
/** Which way the body points: along movement, along the camera, or left alone. */
facing?: "movement" | "camera" | "none"
/** The camera rig: a kind, a kind plus its config, or false to leave the camera alone. */
camera?: false | CameraKind | ({ kind?: CameraKind } & Record<string, unknown>)
/**
* A first-person view-model (`ViewModel`): frames of project PNGs, each placed by its pivot on a
* virtual canvas and swung by the first-person rig's `bob`. Drawn only while the first-person rig
* is the view. `playerInstance(ctx).viewModel.show(ctx, "fire")` switches frames.
*/
viewModel?: ViewModelConfig
/** Extra rigs available to `camera-switch`, keyed by kind. */
cameras?: Partial<Record<CameraKind, Record<string, unknown>>>
/** Default blend, in seconds, for `camera-switch`. */
cameraBlend?: number
/** Rebinding data for `InputMap.fromJSON`. */
input?: Record<string, unknown>
/** The context this behavior plays in. Defaults to the built-in map's `"gameplay"`. */
gameplayContext?: string
/** The context `menu-open` switches to. Defaults to the built-in map's `"menu"`. */
menuContext?: string
/** Set false to ignore `menu-open`, `menu-close` and `input-context` entirely. */
contextSwitching?: boolean
}
Import: import type { PlayerProps } from "@argus/gameplay"
Members
| Member | Signature | Description |
|---|---|---|
speed | speed?: number | Metres per second; overrides the controller component's speed. |
jump | jump?: number | Jump strength; overrides the component's jump. Meaning is the Rust controller's. |
crouchSpeedScale | crouchSpeedScale?: number | Multiplier on speed while crouched. |
sprintScale | sprintScale?: number | Multiplier on speed while the sprint action is held (unbound by default). |
crouchMode | crouchMode?: "hold" | "toggle" | Hold to stay crouched, or press to toggle. |
requireGrounded | requireGrounded?: boolean | Only jump when the controller reports it is grounded. |
cameraRelative | cameraRelative?: boolean | Move relative to the camera's heading rather than world axes. Read only when this behavior owns the controller (input: "script"); under auto the component's inputBasis decides, for the engine and for this behavior alike. |
facing | facing?: "movement" | "camera" | "none" | Which way the body points: along movement, along the camera, or left alone. |
camera | camera?: false | CameraKind | ({ kind?: CameraKind } & Record<string, unknown>) | The camera rig: a kind, a kind plus its config, or false to leave the camera alone. |
viewModel | viewModel?: ViewModelConfig | A first-person view-model (ViewModel): frames of project PNGs, each placed by its pivot on a virtual canvas and swung by the first-person rig's bob. Drawn only while the first-person rig is the view. playerInstance(ctx).viewModel.show(ctx, "fire") switches frames. |
cameras | cameras?: Partial<Record<CameraKind, Record<string, unknown>>> | Extra rigs available to camera-switch, keyed by kind. |
cameraBlend | cameraBlend?: number | Default blend, in seconds, for camera-switch. |
input | input?: Record<string, unknown> | Rebinding data for InputMap.fromJSON. |
gameplayContext | gameplayContext?: string | The context this behavior plays in. Defaults to the built-in map's "gameplay". |
menuContext | menuContext?: string | The context menu-open switches to. Defaults to the built-in map's "menu". |
contextSwitching | contextSwitching?: boolean | Set false to ignore menu-open, menu-close and input-context entirely. |