Which libraries need to be imported to use XR

@babylonjs/core”: “^4.2.1”,

import { WebXRExperienceHelper } from "@babylonjs/core/XR/webXRExperienceHelper";

import {WebXRFeatureName} from "@babylonjs/core/XR/webXRFeaturesManager";

I run the code to initialize XR locally. The code does not throw an exception, but the interface does not see a button similar to glasses (click to enter XR mode)
In the playground., I think the running code is normal, but the playground. loads all the packages

async function xrsetUP(scene,floorMeshes){
    console.log('xr setup');
    const xr = await scene.createDefaultXRExperienceAsync({
        floorMeshes: floorMeshes
    });
    const featuresManager = xr.baseExperience.featuresManager;
    const teleportation = featuresManager.enableFeature(WebXRFeatureName.TELEPORTATION, "stable", {
        xrInput: xr.input,
        floorMeshes: floorMeshes,
        timeToTeleport: 5000,
        useMainComponentOnly: true,
    });

}

Tagging @RaananW :smiley:

Tha’t sprobably because you are trying to use it in a browser that either doesn’t support XR or that can’t find an XR-environment to work with.

What device are you running this on? What VR/XR devices are connected to this device (or - is it a VR device like the quest?)

Have you tried using the WebXR emulator to test the environment?

Later, the test found that the HTML button of the knowledge glasses icon did not display normally. By customizing the button, the CSS of the HTML button was adjusted and the display was normal

1 Like

I didn’t find any reason why the HTML of the default button is not displayed. Finally, I customized one, using fixed for layout, position: fixed;

Hello, @qqqzhch just checking in, was your question solved?

1 Like