It represents a connected gamepad and has the information of all its buttons and axes..

const gamepad = this.inputManager.gamepads[0];

if (gamepad.dpadAxes.x > 1) {
// if the depad x-axis is pressed to the right, do some action
}

if (gamepad.rightFace) {
// if the right face button is pressed, do some action
}

Constructors

Properties

connected: boolean

TRUE if the gamepad is connected

id: string

The gamepad id

index: number

The gamepad index

vibrating: boolean

TRUE if the vibration is on

Accessors

Methods

  • Turns on the gamepad vibration

    Parameters

    • duration: number = 200

      The duration of the effect in milliseconds

    • weakMagnitude: number = 0.2

      Rumble intensity of the high-frequency (weak) rumble motors, normalized to the range between 0.0 and 1.0

    • strongMagnitude: number = 0.2

      Rumble intensity of the low-frequency (strong) rumble motors, normalized to the range between 0.0 and 1.0

    • startDelay: number = 0

      The delay in milliseconds before the effect is started

    Returns void