Skip to main content
New Participant
January 30, 2023
Solved

Update to Oculus Browser broke controller button input

  • January 30, 2023
  • 4 replies
  • 3901 views

It looks like a recent update to the Oculus Browser may have broken getting input for the A and B buttons with WebXR/THREE.js. Has anyone seen a similar issue or can confirm? I tested on Both a Quest 2 and a Quest Pro and both reproduce the issue.

Here's some example code which used to work:
https://github.com/fbriggs/lifecast_public/blob/main/web/lifecast_res/LifecastVideoPlayer8.js#L571

The most important parts of the code are:

renderer = new THREE.WebGLRenderer({
antialias: false,
powerPreference: "high-performance",
depth: true
});
...
vr_controller0 = renderer.xr.getController(0);
vr_controller1 = renderer.xr.getController(1);
...
vr_controller.button_A = vr_controller.gamepad.buttons[4].value > 0;
vr_controller.button_B = vr_controller.gamepad.buttons[5].value > 0;

    Best answer by futureforest

    Update: the solution was to upgrade Three.js from version 131 to 149. On version 131, the issue was somewhere near here:
    https://github.com/fbriggs/lifecast_public/blob/main/web/lifecast_res/LifecastVideoPlayer8.js#L581

    The ''connected' event on the controller objects (renderer.xr.getController(0)) was never triggered with Three.js version 131, but is now in version 149. It is still a mystery why that worked before and then stopped working. I didn't find any race conditions.

    4 replies

    New Participant
    January 30, 2023

    Can you try visiting https://immersive-web.github.io/webxr-samples/controller-state.html and see if clicking A and B shows up while you're in immersive?

    We haven't heard about any issues in this area.

    New Participant
    January 30, 2023

    Can you send us the link to a live website so we can debug.

    We looked over your code and it's possible that there's a race condition in it.

    New Participant
    January 31, 2023

    Thanks for the quick reply. Here's a link to it running where it previously responded to A and B buttons but doesn't now:

    https://holovolo.tv/v/e3c6ff

    futureforestAuthorAnswer
    New Participant
    February 7, 2023

    Update: the solution was to upgrade Three.js from version 131 to 149. On version 131, the issue was somewhere near here:
    https://github.com/fbriggs/lifecast_public/blob/main/web/lifecast_res/LifecastVideoPlayer8.js#L581

    The ''connected' event on the controller objects (renderer.xr.getController(0)) was never triggered with Three.js version 131, but is now in version 149. It is still a mystery why that worked before and then stopped working. I didn't find any race conditions.