A gamepad, with buttons and axes named by position. Buttons are south, east, west, north,
left-bumper, right-bumper, left-trigger, right-trigger, select, start, left-stick,
right-stick, dpad-up, dpad-down, dpad-left, dpad-right and home, plus each stick
direction, like left-stick-up. Axes are left-x, left-y, right-x and right-y. Gamepads
without the 'standard' mapping get button-0, axis-0 and so on.
On this page
Events
{ type: 'connected' }Fired when the gamepad connects.
{ type: 'disconnected' }Fired when the gamepad disconnects.
Properties
id: string
The browser's id for the controller model.
brand: string
'xbox', 'playstation', 'nintendo', or '' when unknown.
slot: number
The controller's slot in the manager, or -1 once removed by reassignSlots.
mapping: string
The browser's mapping: 'standard', or '' when the controller isn't recognized.
hasRumble: boolean
Whether rumble supports 'dual-rumble'.
hasTriggerRumble: boolean
Whether rumble supports 'trigger-rumble'.
deadZone: number
Stick values under this distance from center read as 0.
Methods
getButtonName( name: string ): stringThe name printed on the controller for a button, e.g. 'A' or 'Cross'. Xbox names for
unknown brands.
rumble(
// `'dual-rumble'` or `'trigger-rumble'`.
type: string,
// The `playEffect` parameters.
params?: Object
): Promise<string>Plays a rumble effect through vibrationActuator.playEffect. Check hasRumble first.
stopRumble(): Promise<string>Stops the current rumble effect.
Inherited
From Controller
- Properties