Taos API Reference
    Preparing search index...

    Class GamepadController

    Polled Gamepad-API input source. Construct directly for a long-lived pad, or use setupGamepadControlsLazy to defer until the first connect.

    Index

    Constructors

    Accessors

    • get hasVibration(): boolean

      True if the currently-bound gamepad exposes either vibrationActuator (modern Chromium / Edge) or a legacy hapticActuators[0] (older Chrome, some Firefox builds). False when no pad is bound or the pad reports neither API.

      Returns boolean

    Methods

    • Play a haptic effect on the currently-bound gamepad. Accepts either an HapticEffect or a duration shorthand (vibrate(120) = 120 ms at full magnitude on both motors).

      Resolves true if the effect was dispatched, false if the pad reports no actuator. Never throws — browser rejections (effect canceled, pad unplugged mid-effect) are swallowed and resolve to false.

      Parameters

      Returns Promise<boolean>

    • Read the live pad and dispatch any changes. Called automatically when autoPoll is true.

      Parameters

      • dt: number

      Returns void