Teleport and Movement using WeXR and Quest 3

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:

  1. What I am missing to make the teleporting work?
  2. 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.

cc @RaananW

Teleportation should work out of the box.

I have noticed you attach the features yourself - this is not needed. Attach is happening when the session starts. I can only assume that you are attaching too early, and some listeners are not attached.

I tried also without the attachment.
I am sure it is something obvious that I am just not seeing.
I will try a few more things next weekend and look for more info.
Thanks for now @RaananW and @carolhmj

1 Like

Please let me know if it still doesn’t work!

Have you tried our playgrounds? This, for example?

WebXR basic example with teleportation | Babylon.js Playground (babylonjs.com)

Sorry for taking so long to answer, but I only can work in this project at weekends.

Yes, I tried the playgrounds, but I suspect my problem is more basic and obvious. I never developed for games before and probably is something very obvious.
Because I can turn the head in VR and the left and right turns of head works, I am sure is related to moving and not to VR itself. The system enters VR mode, control is detecting the button pressing, I can look around, but I can not move in the scene. Neither “walking” or teleporting. (I am not really sure about the right button to teleport, not none of them trigger the function. Maybe I need define something above the plane to define possible targets. Not sure.
I will make some more tests today and let you know the result.
Thanks for now.

Ok, I rechecked the code. The VR part is working, but the problem I am experiencing is related to the movement.
I realize that I can not trigger the teleportation in the code you pointed out in your reply, @RaananW . It is another issue. Maybe I just don’t know how to trigger it, or maybe I need to implement the whole player and movement before it works.
Matter of fact is I could not find any example of how to put player + movement + VR together and because I went straight to VR games, I never did it for “flat” games.
I think I should take a step back and implement it for the non-VR experience, which goes back to this issue.
Clearly, I am missing the foundation of my knowledge in this area.
Thanks for now