Pressed-state per button, indexed in the same order as the underlying Gamepad.buttons. Index with CONTROLLER_KEYS. Updated by poll; empty until the first non-cached poll.
Read the current gamepad state and return one Vec2 per stick pair with a circular deadzone applied (0.25 inner radius, output magnitude clamped to [0, 1]). The returned array (and each Vec2 in it) is reused across calls — clone if you need to retain. Also refreshes buttons. Returns the cached array unchanged when the gamepad timestamp hasn't advanced.
Clear buttons and the cached stick axes. Called automatically on window blur and on gamepad disconnect.
Trigger a 400 ms full-strength dual-rumble pulse. Returns false when no gamepad is connected or the pad has no vibrationActuator; true when the effect was dispatched.
Gamepad input. The first connected gamepad becomes "our" gamepad; later ones are ignored until ours disconnects. Connection / disconnection fires EventSystem
"inputControllerConnected"/"inputControllerDisconnected".Poll buttons (indexed via CONTROLLER_KEYS) and poll from your
update. State is cleared onwindowblur and on disconnect so held buttons / non-neutral sticks don't stay live across focus loss. Visualizing is not the controller's responsibility — see ControllerCursor for the built-in on-screen visualization, or read poll directly to drive your own.Logs to
console.errorif the browser doesn't expose the Gamepad API.