Is it possible to turn off hands and controllers in the WebXR AR mode?

I want to disable all hand/controller interactions and hide the 3D models for them completely. Is this possible with the WebXR script?

Original Post on Discord

by user 264626421891072001

Hello there – we have an experimental AI bot :robot: that might be able to help you with your question. Would you like to try this out?

How it works:
Reply to the messages of the bot that end with a thread_id to interact with it and ask follow-up questions. You can also mention the bot directly in this channel to get help.

Help requested: please wait a moment…

Here is what I found for you :brain: Discord

To disable all hand/controller interactions and hide the 3D models for the controllers in WebXR, you can simply avoid adding WebXRController components to your scene, or if they are already present, disable or remove these components from your game objects. Additionally, ensure that no controller models are being instantiated within the scene, which means not calling the relevant methods to create controller models in the first place. This will prevent interactions and hide the controllers.

Here’s a code snippet demonstrating how to disable controller interactions if the WebXRController component was added:

import { WebXRController } from '@needle-tools/engine';

export class MyWebXRModifier extends Behaviour {
    override start() {
        // Find controllers and disable them
        const controllers = this.context.mainCameraComponent.getComponentsInChildren(WebXRController);
        controllers.forEach(controller => controller.enabled = false);

Please ensure this script runs at the start of your scene or before any interactions can occur. This is a generic approach, and the actual implementation may vary based on how you have set up your scene and components (see the documentation).

1 messages left GPT 4

We’re in the process of refactoring our WebXR implementation to make things like this easier.

For now you can hide them manually after they are created (they’re child objects of the controllers)

You can access the controllers via the static field in WebXR.Controllers in the old implementation, they are available once webxr has started / during an active xr session