The Gamepad Input object allows access to the gamepad on HTML5 targets using the Gamepad API.
With this object, you can use the provided conditions to easily check the state of the analog sticks, D-Pad, and other buttons. The analog stick conditions function similarly to Fusion's own joystick conditions, where you are simply checking if the stick is moving in a certain direction and not its exact position value.
Please login to see this attachment.
More exact data like the analog stick's position along a specific axis is available through expressions if you'd prefer to interact with the gamepad that way though.
Download
Version 1.0 of the Gamepad Input Object can be downloaded from its Github repo here: Please login to see this link.
You can also get it from the attachment in this thread.
Files and Installation
Inside you will find the Data, Examples, Extensions, and Help folders which can be installed by simply dragging and dropping them into your Fusion installation directory. The documentation can be found in the GamepadInput.html file in Help\Gamepad Input.
Gamepad API Notes
Gamepad devices are identified by a numerical index value. This value will be provided to most conditions and expressions so it knows which device you want to interact with.
Keep in mind the index value is NOT THE SAME as the player number that may be shown on your device, which means index 0 may not always equal player 1's controller. To my knowledge, there is currently no way to identify a device using the Gamepad API based on its player number visible on the controller. This is not really a problem for singleplayer games, but may require some workarounds for local multiplayer games (see the "Local Multiplayer Workarounds" section in the documentation).
The Gamepad API waits for an interaction from a specific device before identifying it and adding to the list of accessible devices. So even if your controller is connected, it will need to send some kind of input (joystick movement, button press, etc) before being identified.
Questions or Problems?
If you have a question about this object or have found a bug, please don't hesitate to let me know in this thread or reach out to me through the forum message system.