Skip to content

free-camera.controller overview


Table of contents


utils

FreeCameraController (class)

A controller for a free-moving camera.

Signature

export declare class FreeCameraController {
  constructor(
    protected readonly keyboard: KeyboardInput,
    protected readonly camera: Renderer3dEntity,
    options: Partial<FreeCameraControllerOptions> = {}
  )
}

onSpawned (method)

Signature

async onSpawned(world: GgWorld<any, any>): Promise<void>

onRemoved (method)

Signature

async onRemoved(): Promise<void>

tickOrder (property)

Signature

readonly tickOrder: TickOrder.INPUT_CONTROLLERS

options (property)

Signature

readonly options: FreeCameraControllerOptions

mouseInput (property)

The mouse input controller used for camera rotation.

Signature

readonly mouseInput: MouseInput

directionsInput (property)

The keyboard input controller used for camera movement.

Signature

readonly directionsInput: DirectionKeyboardInput

FreeCameraControllerOptions (type alias)

Options for configuring a FreeCameraInput controller.

Signature

export type FreeCameraControllerOptions = {
  /**
   * A keymap for controlling camera movement, where each key corresponds to a movement direction.
   */
  keymap: DirectionKeyboardKeymap
  /**
   * Options for configuring camera movement.
   */
  movementOptions: {
    /**
     * The speed of camera movement.
     */
    speed: number
  }
  /**
   * Flag to ignore cursor movement if pointer was not locked. By default false
   */
  ignoreMouseUnlessPointerLocked: boolean
  /**
   * Flag to ignore keyboard events if pointer was not locked. By default false
   */
  ignoreKeyboardUnlessPointerLocked: boolean
  /**
   * Options for configuring mouse input.
   */
  mouseOptions: Partial<MouseInputOptions>
}