WebXR Disable VR Controllers

Yo @RaananW … Is there any way to disable the webxr controllers in VR mode. I want to manually move the VR Camera(s) and dont want controllers to be enabled. How can i do this ?

Sure, the default xr experience helper has the option:

const xr = await scene.createDefaultXRExperienceAsync({
        inputOptions: {
            doNotLoadControllerMeshes: true
        }
    });

I tried that… that option only stops the controller meshes from loading… You can still interact with items
… I think you may need both doNotLoadControllerMeshes and disablePointerSelection

Just was not sure if that was the way to go… vs there being some disableControllers option i was just not seeing

1 Like

Oh!

You can detach the teleportation and pointer features if you want.
I just now understood what you are referring to, sorry :slight_smile:

If you want the controllers, but don’t want them to interact with the scene, either detach teleportation and pointerSelection (in your xrHelper), or disable those features altogether. There are also flags to disable them when creating the experience helper.

What’s the approach to doNotLoadControllerMeshes without reinitializing a whole new XRExperience?

you can enable the feature with new options without creating a new XR experience. simnply call featuresManager.enableFeature with the feature’s name, its version and the new options. it will dispose of the old feature and reinitialize the current feature with new options

Maybe I’m missing something, the interface for the option is here

However, I don’t see what feature it is connected to. The closest feature is the PHYSICS_CONTROLLERS but I don’t want to enable that. What’s the name of the feature just for the controllers which applies the IWebXRControllerOptions interface.

Even better, do you have an example code for disabling the controllers?

Sorry!

I thought we were talking about the pointer selection feature, but you are right - this is a part of the WebXRInput class. You can dispose the old one and create a new one, changing the options

But I wonder - why would you want to change the behavior in-session? why not set it beforehand? (or disable/dispose already-loaded meshes)

Thanks, that makes sense.

I’m using babylon through the react-babylon framework

There’s some stuff that needs workarounds so I’m just exploring different options :smiley:

1 Like