Multiple Game Input Controllers
Copy link to clipboard
Copied
I've been trying to get multiple game controllers to work in my game.
It works great when only one game controller is used. However when trying to use multiple controllers, a single control will trigger for every controller, essentially allowing one person to play as every player.
Calling device.getControlAt(0) will say that the control is triggered for every device. Checking control.device will return the correct device, but the value will be changed for every control. The only help I can seem to find is here:
To identify individual devices:
- Add event listeners to every control on all undetected input devices. These listeners listen for
Event.CHANGE
events, which are dispatched whenever a control value changes. - The first time a control is activated (for example a button press or trigger pull), the application labels that device.
- Remove all of the event listeners from the remaining undetected input devices.
Repeat steps 1-3, as required, to identify the remaining undetected input devices.
This doesn't make any sense to me. The devices are detected, all the controls just seem to be linked. Any help is much appreciated.
Have something to add?

