Skip to content

Controller.controllers

Samir Zahran edited this page May 18, 2017 · 5 revisions

Type: Object {index: Controller}

A zero-indexed list of gamepads currently connected.

Indices are not necessarily consecutive, but do represent a gamepad's index when calling Controller.getController()or getting a gamepads's id.

Example

console.log(Controller.controllers);

>> Object {
>>     0: Controller,
>>     1: Controller,
>>     3: Controller
>> }

Gamepad indeces may be non-consecutive if a gamepad in the middle of the list is disconnected. New controllers will be added to the lowest available slot, so an index that was once undefined may become defined in the future.

Clone this wiki locally