Mapping Oculus Quest 2 Buttons


I’m a newbie with babylonJS and VR in general. I tried to map the button of my oculus quest 2 using this sample :

but no button is detected.
Any idea ?
Thanks Michel

adding @RaananW


this example uses WebVR and the WebVR experience helper which is deprecated and is not recommended at all. Have you checked our WebXR support?

Thank you very much.
I had not found these pages.
The example given in webxr controllers support section almost works :slight_smile: The joysticks are still associated with the movement of the camera, but this already helps me a lot.

you can disable the camera movement by disabling the teleportation’s rotation feature

I have a question related to controller buttons, but probably not worth a separate topic. Is it possible to make buttonDown & buttonUp states for the onButtonStateChangedObservable, in addition to pressed? I would add those if it were possible, but do not want to chew up a lot of time just trying to figure out whether it can be done or not.

Just for me to understand, what is the difference between pressed true/false and buttonUp/buttonDown? (BTW - the states are coming from the API, not defined by us. We can add states though)

I guess just semantics. I was looking for 2, but that should work. For really good integration, I probably need start doing something every frame in between while down, but that is app level.

i would prefer to keep the api as clean as possible. if pressed true/false is enough, it will be the best to use it this way

1 Like

The WebXR environment is working with the Oculus Quest 2 but only when launched within the playground. Do you have any idea how to make it work as a “standalone” page ?
I imagine there is a kind of polyfill used with the playground ?

It should, of course, work in any environment.

The playground is not special in any way. No polyfill or special code is incorporated there to make it work.
You just need to make sure your site is served over https, because WebXR requires that.