WebXR forward motion instead of teleportation

Is there a way to change the action of the forward joystick controller press in WebXR mode from initiating a teleportation to instead taking a small forward-motion step?
This would provide a better user interface for my use case. The user needs to only adjust positon by small amounts and its a bit anoying to always have to look down and aim precisely.

we have webxr movement feature which can be used instead of the teleportation - WebXR Selected Features | Babylon.js Documentation (babylonjs.com)

1 Like

This is really great. I tried it out and it works fine.
However I did not find out, how to change the movement speed (can you please help?) and how to constrain the movement to the floor.

In the documentation I did not see much about preventing the camera colliding with objects, but found a nice example in the documentation which showcases exactly this.

Can one also constrain the movement to a ground mesh, so the user cannot run away? I guess building invisible collision walls would be one way, but is there a simpler solution?

I am sorry. It is written in the manual

Here is an example snippet:

        const featureManager = xr.baseExperience.featuresManager;

        featureManager.enableFeature(BABYLON.WebXRFeatureName.MOVEMENT, "latest", {
            xrInput: xr.input,
            movementOrientationFollowsViewerPose: true, // default true
            movementSpeed: 0.2,
            rotationSpeed: 0.2,
        });

What may be interesting would be to also allow stepwise motion and turns like in the teleportation port. This smooth motion seems to cause more nausea.

That’s a great idea TBH. We should abstract the rotation behavior from both of those and enable both of them in both modules. Want to create a github issue for that? I will be happy to look into it when I get the time. That might take a little while :slight_smile:

1 Like