Signature
Usage
Config
| Field | Type | Default | Description |
|---|---|---|---|
axes | Record<number, string> | — | Axis index → actuator name |
buttons | Record<number, string> | — | Button index → actuator name |
deadzone | number | 0.1 | Axis values below this are treated as zero |
scale | number | 1.0 | Multiplier for axis values |
gamepadIndex | number | 0 | Which gamepad to use (if multiple connected) |
enabled | boolean | true | Enable/disable gamepad input |
Standard Gamepad Axes
| Index | Axis |
|---|---|
0 | Left stick X |
1 | Left stick Y |
2 | Right stick X |
3 | Right stick Y |
Standard Gamepad Buttons
| Index | Button |
|---|---|
0 | A / Cross |
1 | B / Circle |
2 | X / Square |
3 | Y / Triangle |
4 | Left bumper |
5 | Right bumper |
6 | Left trigger |
7 | Right trigger |
Notes
- Uses the Gamepad API
- Gamepad state is polled each frame via
navigator.getGamepads() - Axes values are in the range
[-1, 1]after deadzone filtering - Button values map to
[0, 1](pressed = 1)