# WebXR forward motion instead of teleportation

**URL:** <https://forum.babylonjs.com/t/webxr-forward-motion-instead-of-teleportation/41659>\
**Category:** Questions\
**Tags:** webxr\
**Created:** [June 16, 2023, 8:42am UTC](https://forum.babylonjs.com/t/webxr-forward-motion-instead-of-teleportation/41659 "2023-06-16T08:42:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rainerheintzmann/32/32692_2.png) [@RainerHeintzmann](https://forum.babylonjs.com/u/RainerHeintzmann)\
**Post date:** [June 16, 2023, 8:42am UTC](https://forum.babylonjs.com/t/webxr-forward-motion-instead-of-teleportation/41659/1 "2023-06-16T08:42:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 16, 2023, 10:34am UTC](https://forum.babylonjs.com/t/webxr-forward-motion-instead-of-teleportation/41659/2 "2023-06-16T10:34:40Z")

</div>

we have webxr movement feature which can be used instead of the teleportation - [WebXR Selected Features | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/features/featuresDeepDive/webXR/WebXRSelectedFeatures#movement-module)

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rainerheintzmann/32/32692_2.png) [@RainerHeintzmann](https://forum.babylonjs.com/u/RainerHeintzmann)\
**Post date:** [June 17, 2023, 1:17pm UTC](https://forum.babylonjs.com/t/webxr-forward-motion-instead-of-teleportation/41659/3 "2023-06-17T13:17:53Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rainerheintzmann/32/32692_2.png) [@RainerHeintzmann](https://forum.babylonjs.com/u/RainerHeintzmann)\
**Post date:** [June 19, 2023, 10:32am UTC](https://forum.babylonjs.com/t/webxr-forward-motion-instead-of-teleportation/41659/4 "2023-06-19T10:32:12Z")

</div>

I am sorry. It is written in the manual

> **[WebXR Selected Features | Babylon.js Documentation](https://doc.babylonjs.com/features/featuresDeepDive/webXR/WebXRSelectedFeatures#movement-module)**
>
> Learn about key WebXR features in Babylon.js.

Here is an example snippet:

```javascript
        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.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 19, 2023, 10:51am UTC](https://forum.babylonjs.com/t/webxr-forward-motion-instead-of-teleportation/41659/5 "2023-06-19T10:51:52Z")

</div>

> [@RainerHeintzmann](#):
>
> to also allow stepwise motion and turns like in the teleportation port

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 🙂
