Gamepad

Represents a gamepad

Hierarchy

Index

Constructors

constructor

Find examples in Playground
  • new Gamepad(id: string, index: number, browserGamepad: any, leftStickX?: number, leftStickY?: number, rightStickX?: number, rightStickY?: number): Gamepad
  • Initializes the gamepad

    Parameters

    • id: string

      The id of the gamepad

    • index: number

      The index of the gamepad

    • browserGamepad: any

      The browser gamepad

    • Optional leftStickX: number

      The x component of the left joystick

    • Optional leftStickY: number

      The y component of the left joystick

    • Optional rightStickX: number

      The x component of the right joystick

    • Optional rightStickY: number

      The y component of the right joystick

    Returns Gamepad

Properties

browserGamepad

Find examples in Playground
browserGamepad: any

The browser gamepad

id

Find examples in Playground
id: string

The id of the gamepad

index

Find examples in Playground
index: number

The index of the gamepad

isConnected

Find examples in Playground
isConnected: boolean

Specifies if the gamepad has been connected

leftStick

Find examples in Playground
leftStick: StickValues

Sets the left joystick values

rightStick

Find examples in Playground
rightStick: StickValues

Sets the right joystick value

type

Find examples in Playground
type: number

Specifies what type of gamepad this represents

Static GAMEPAD

Find examples in Playground
GAMEPAD: number

Represents a gamepad controller

Static GENERIC

Find examples in Playground
GENERIC: number

Represents a generic controller

Static POSE_ENABLED

Find examples in Playground
POSE_ENABLED: number

Represents a pose-enabled controller

Static XBOX

Find examples in Playground
XBOX: number

Represents an XBox controller

Methods

dispose

Find examples in Playground
  • dispose(): void
  • Disposes the gamepad

    Returns void

onleftstickchanged

Find examples in Playground
  • onleftstickchanged(callback: function): void
  • Callback triggered when the left joystick has changed

    Parameters

    Returns void

onrightstickchanged

Find examples in Playground
  • onrightstickchanged(callback: function): void
  • Callback triggered when the right joystick has changed

    Parameters

    Returns void

update

Find examples in Playground
  • update(): void
  • Updates the gamepad joystick positions

    Returns void

Generated using TypeDoc