Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...

    First-person "fly" camera controls with quaternion orientation and inertial physics.

    Drives the camera from keyboard (WASD movement, arrow-key look, Q/E roll, Shift boost) and mouse (left-drag strafe, right-drag look, scroll to move, Shift+scroll to roll). In the default inertial mode, motion is integrated as damped velocity each frame rather than applied instantly, so inertialMode and the damping factors control how much the camera glides; when inertialMode is false, mouse strafe / scroll / roll are applied directly, while keyboard motion and mouse-drag look stay velocity-integrated. Rotation uses a quaternion, so there is no gimbal lock and orientation is unbounded.

    Input listeners are attached at construction. Set externalInputManagement to have the caller forward key events via handleKeyDown / handleKeyUp instead of registering global keyboard listeners; mouse input is always handled internally. Call update once per frame with the elapsed delta to advance the physics.

    ControlsManager which owns and switches between control modes

    Hierarchy

    • EventDispatcher<{ change: {}; start: {}; end: {} }>
      • LuxarFlyControls
    Index
    enabled: boolean = true
    movementSpeed: number = config.controls.fly.movement.speed.default
    rotationSpeed: number = config.controls.fly.rotation.speed.default
    lookSpeed: number = config.controls.fly.look.mouseSpeed.default
    inertialMode: boolean = config.controls.fly.inertialMode.default
    damping: number = config.controls.fly.movement.damping.default
    rotationDamping: number = config.controls.fly.rotation.damping.default
    moveState: FlyMoveState = ...
    lookState: FlyLookState = ...
    speedBoost: boolean = false
    velocity: Vector3 = ...
    angularVelocity: Vector3 = ...
    orientation: Quaternion = ...
    savedPosition: Vector3 = ...
    savedOrientation: Quaternion = ...
    activeMouseAction: FlyMouseAction = 'none'
    mouseX: number = 0
    mouseY: number = 0
    touchPointers: Map<number, Vector2> = ...
    pinch: FlyPinchState | null = null
    camera: LuxarCamera
    domElement: HTMLElement
    listenerDisposer: () => void = ...
    externalInputManagement: boolean
    • Public method to handle key down events (for external input management)

      Parameters

      • event: KeyboardEvent

      Returns void

    • Public method to handle key up events (for external input management)

      Parameters

      • event: KeyboardEvent

      Returns void

    • Update controls - must be called in animation loop

      Parameters

      • delta: number

        Time since last frame in seconds

      Returns void

    • Set movement mode

      Parameters

      • inertial: boolean

        True for low damping (momentum), false for high damping (immediate)

      Returns void

    • Smoothly look at a target position

      Parameters

      • target: Vector3

        Target position to look at

      • smoothness: number = 0.9

        Smoothing factor (0-1, higher = smoother)

      Returns void

    • Save current state (for reset functionality).

      Captures camera.position and the internal orientation quaternion at the time of the call — these become the snapshot restored by reset(). NOTE: the constructor invokes this once immediately after initializeFromCamera, so the baseline reflects the camera state at construction time. Callers that mutate the camera AFTER constructing the controls must call saveState() again to update the snapshot.

      Returns void