GamepadAPI
Types
gamepad
This Gamepad API interface defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id.See Gamepad on MDN
typegamepad= {id:string,index:int,connected:bool,timestamp:float,mapping:gamepadMappingType,axes:array<float>,buttons:array<gamepadButton>,vibrationActuator:gamepadHapticActuator,}Record fields
gamepadButton
An individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device.See GamepadButton on MDN
typegamepadButton= {pressed:bool,touched:bool,value:float,}Record fields
gamepadEffectParameters
typegamepadEffectParameters= {mutableduration?:int,mutablestartDelay?:int,mutablestrongMagnitude?:float,mutableweakMagnitude?:float,mutableleftTrigger?:float,mutablerightTrigger?:float,}Record fields
duration
option< int >
startDelay
option< int >
strongMagnitude
option< float >
weakMagnitude
option< float >
leftTrigger
option< float >
rightTrigger
option< float >
gamepadHapticActuator
This Gamepad API interface represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware.See GamepadHapticActuator on MDN
typegamepadHapticActuator= {}Module
There are methods and helpers defined in GamepadHapticActuator.
gamepadHapticEffectType
typegamepadHapticEffectType=| @as("dual-rumble")DualRumble| @as("trigger-rumble")TriggerRumblegamepadHapticsResult
typegamepadHapticsResult=| @as("complete")Complete| @as("preempted")PreemptedgamepadMappingType
typegamepadMappingType=| @as("standard")Standard| @as("xr-standard")XrStandard