A gamepad object
Configuration of which buttons / analogs map to which indexes
Whether the left analog is currently being held
Whether the right analog is currently being held
Static baseThe base analogs position when it is not in use
Static AXESAnalog thumb sticks
Static AXES_User-configurable dead zone threshold (0.0 - 1.0) Default is 0.0 (no dead zone) following industry standards. Developers should configure this based on their application needs. Typical pValues: 0.0 (none), 0.15 (light), 0.25 (medium)
Separate dead zones for left and right analog sticks
Stick drift compensation pValues per axis
Static TRIGGER_The pValue at which holding a trigger (LT OR RT) will consider it being pressed
Static VIBRATION_Vibration presets for common haptic effects
Static PRESSEDValue to indicate a pressed button
Static UNPRESSEDValue to indicate a button is not pressed
Static BUTTONS_A button map that maps common button names to the indexes the computer knows them as
Static BUTTONS_A reverse map of the button names
Static PS4_A small remapped version of the controllers button_map with PS4 alternatives
Static GAMEPAD_PS: Playstation vendor Xbox: XBOX vendor PC: Computer PC vendor Android: Android device vendor
Info about the controller
The timestamp of the gamepad.
The index of the controller.
The gamepad object
The type of controller
Applies circular dead zone filtering with proper scaling to an analog stick
Raw X axis pValue (-1 to 1)
Raw Y axis pValue (-1 to 1)
Dead zone threshold (0.0 - 1.0)
Object with filtered x, y pValues and magnitude
Adds an event listener with optional configuration
The event name (case agnostic)
The callback function
Optional pOptions: EventListenerOptionsOptional configuration (once, priority)
The Controller instance
Removes an event listener
The event name (case agnostic)
The callback function to remove
The Controller instance
Sets the dead zone threshold for this controller
Dead zones ignore small analog stick movements to prevent drift and unwanted input. Values below the threshold are treated as 0. Higher values = more input ignored.
The dead zone threshold (0.0 to 1.0, where 0.15 = 15% dead zone)
Error if deadZone is not between 0 and 1
Sets the dead zone threshold for the left analog stick
Dead zones ignore small analog stick movements to prevent drift and unwanted input. Values below the threshold are treated as 0. Higher values = more input ignored.
The dead zone threshold (0.0 to 1.0, where 0.15 = 15% dead zone)
Error if deadZone is not between 0 and 1
Sets the dead zone threshold for the right analog stick
Dead zones ignore small analog stick movements to prevent drift and unwanted input. Values below the threshold are treated as 0. Higher values = more input ignored.
The dead zone threshold (0.0 to 1.0, where 0.15 = 15% dead zone)
Error if deadZone is not between 0 and 1
Vibrates the controller using a preset pattern
The preset name from VIBRATION_PRESETS (case agnostic)
Optional start delay in ms
Promise that resolves when vibration completes
Vibrate the controller with validation and Promise support
dual-rumble: Dual-rumble describes a haptic configuration with an eccentric rotating mass vibration motor in each handle of a standard gamepad. In this configuration, either motor is capable of vibrating the whole gamepad. The two masses are unequal so that the effects of each can be combined to create more complex haptic effects.
The type of rumble. "dual-rumble", or "vibration"
The start delay before the vibration occurs in ms
The duration of the vibration in ms
The magnitude of the weak actuator (between 0 and 1).
The magnitude of the strong actuator (between 0 and 1).
Promise that resolves when vibration completes
Creates a new controller instance and passes the gamepad it will be created with