I trying to use the WebXR to create a experience for Quest 3. I followed the documentation and a few of tutorials with no much result.
I am able to enter the VR mode, point the controllers to the ground and the Raytrace detect the ground (turns blue with a dot the level of the ground).
But for some reason, I cannot teleport for a new place. I am missing something, but there is nothing in the docs about what I me missing.
The VR enabling is as follows:
private async _engageVR(scene: Scene) {
const parcel = this.landscape.getParcelByAddress(0, 0, 0);
const xrSupport = await WebXRSessionManager.IsSessionSupportedAsync(
"immersive-vr"
);
if (!xrSupport) {
console.log("error, no XR support");
} else {
this.environment = scene.createDefaultEnvironment();
// XR
this.xrExperience = await scene.createDefaultXRExperienceAsync({
floorMeshes: [parcel.ground],
});
this.xrExperience.teleportation.attach();
this.xrExperience.pointerSelection.attach();
}
// Latest try - also no transportation
// try {
// this.xrExperience = await scene.createDefaultXRExperienceAsync({
// floorMeshes: [parcel.ground],
// });
// if (!this.xrExperience.baseExperience) {
// console.log("No XR support detected");
// this.xrExperience.teleportation.attach();
// this.xrExperience.pointerSelection.attach();
// } else {
// console.log("Engaging XR experience");
// }
// return true;
// } catch (error) {
// console.log("Error detecting XR support", error);
// return false;
// }
}
}
Maybe is some interference from the code that generate the player, but I tried deactivate with no results:
_createPlayer(scene: Scene, engine: Engine) {
const camera = new ArcRotateCamera(
"camera",
-Math.PI / 2,
Math.PI / 2.7,
2000,
new Vector3(0, 0, 0)
);
camera.attachControl(engine.getRenderingCanvas(), true);
this._engageVR(scene);
}
I have some questions:
- What I am missing to make the teleporting work?
- The initialization of the controllers made for createDefaultXRExperienceAsync() is suposed to initialize the moviment of the player also or I should deal with the during the game loop?
Thanks for the help and patience with a newbie.