01-30-2023 02:23 PM
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;
Solved! Go to Solution.
02-07-2023 03:04 PM
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.
01-30-2023 02:46 PM
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.
01-30-2023 02:52 PM
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.
01-30-2023 07:16 PM
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
02-07-2023 03:04 PM
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.