Skip to content

Add an update event to the WebXRController so individual gamepad data can be handled. #32350

@danrossi

Description

@danrossi

Description

I have a requirement to poll gamepad data to handle button and joystock inputs. Polling it externally is clunky as I have to make dynamic callbacks when a controller connects.

I was forced to patch to the controller to override the update method to handle gamepad data. And it provides individual events for gamepad controls.

https://github.com/danrossi/three-xr-controller/blob/main/src/XRController.js#L132

If an update event or callback is provided on the controller individual gamepad data can be handled.

Or integrate this code as a feature in examples

https://github.com/danrossi/three-xr-controller/blob/main/src/XRController.js#L79

Solution

An event provided on the update method of the WebXRController or an event on the XRControllerModel but its not obvious which button is active in that.

Alternatives

na

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions