Talos docs

PlayerProps

Since 0.6
Plain text

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

MemberSignatureDescription
speedspeed?: numberMetres per second; overrides the controller component's speed.
jumpjump?: numberJump strength; overrides the component's jump. Meaning is the Rust controller's.
crouchSpeedScalecrouchSpeedScale?: numberMultiplier on speed while crouched.
sprintScalesprintScale?: numberMultiplier on speed while the sprint action is held (unbound by default).
crouchModecrouchMode?: "hold" | "toggle"Hold to stay crouched, or press to toggle.
requireGroundedrequireGrounded?: booleanOnly jump when the controller reports it is grounded.
cameraRelativecameraRelative?: booleanMove 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.
facingfacing?: "movement" | "camera" | "none"Which way the body points: along movement, along the camera, or left alone.
cameracamera?: false | CameraKind | ({ kind?: CameraKind } & Record<string, unknown>)The camera rig: a kind, a kind plus its config, or false to leave the camera alone.
viewModelviewModel?: ViewModelConfigA 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.
camerascameras?: Partial<Record<CameraKind, Record<string, unknown>>>Extra rigs available to camera-switch, keyed by kind.
cameraBlendcameraBlend?: numberDefault blend, in seconds, for camera-switch.
inputinput?: Record<string, unknown>Rebinding data for InputMap.fromJSON.
gameplayContextgameplayContext?: stringThe context this behavior plays in. Defaults to the built-in map's "gameplay".
contextSwitchingcontextSwitching?: booleanSet false to ignore menu-open, menu-close and input-context entirely.