Oculus Quest 2 - Y X B A Menu Touch - input data from buttons?

Is there any comfortable way in ThreeJS to get all the data from all controller buttons - not only from trigger and squeze)?

1 Like

I don’t have your controllers, but I guess at some point in your code you probably do something like

renderer.xr.getControllerGrip(0)

So for the event listener you can

console.log(e.data.gamepad)

to get all the gamepad buttons and axes.

My Oculus CV1 controller gives the above response.

Eg,

const controllerGrip0 = renderer.xr.getControllerGrip(0)
controllerGrip0.addEventListener("connected", (e) => {
    console.log(e.data.gamepad)
})

And then in your code you can check whether buttions are pressed or the current values of the axes.

if (your-game-pad-ref.buttons[1].pressed) { ...

That’s what I do in the libs TeleportVR and GrabVR

1 Like