# Webxr camera rotation-position and old camera rotation-position

**URL:** <https://forum.babylonjs.com/t/webxr-camera-rotation-position-and-old-camera-rotation-position/31163>\
**Category:** Questions\
**Created:** [June 8, 2022, 11:33am UTC](https://forum.babylonjs.com/t/webxr-camera-rotation-position-and-old-camera-rotation-position/31163 "2022-06-08T11:33:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![farukcelim](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/farukcelim/32/27134_2.png) [@farukcelim](https://forum.babylonjs.com/u/farukcelim)\
**Post date:** [June 8, 2022, 11:33am UTC](https://forum.babylonjs.com/t/webxr-camera-rotation-position-and-old-camera-rotation-position/31163/1 "2022-06-08T11:33:44Z")

</div>

Hi  
I want the camera to get its final rotation and position after WebXR runs. But it resets after WebXR runs. Can you help?

> **[Babylon.js Playground](https://playground.babylonjs.com/#9K3MRA%23898)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [June 8, 2022, 3:16pm UTC](https://forum.babylonjs.com/t/webxr-camera-rotation-position-and-old-camera-rotation-position/31163/2 "2022-06-08T15:16:52Z")

</div>

cc @RaananW the king of all the …R

---

<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 8, 2022, 4:12pm UTC](https://forum.babylonjs.com/t/webxr-camera-rotation-position-and-old-camera-rotation-position/31163/3 "2022-06-08T16:12:58Z")

</div>

You need to understand the flow of observables in order to make it work correctly. I assume this is what you wanted to achieve:

[WebXR basic example with teleportation | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#9K3MRA#899)

Every time an XR session, run this code on the next frame.

---

<div class="post-metadata">

**Author:** ![farukcelim](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/farukcelim/32/27134_2.png) [@farukcelim](https://forum.babylonjs.com/u/farukcelim)\
**Post date:** [June 9, 2022, 6:36am UTC](https://forum.babylonjs.com/t/webxr-camera-rotation-position-and-old-camera-rotation-position/31163/4 "2022-06-09T06:36:21Z")

</div>

No, I mean  
With the camera angle like this, I start the XR.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/8/d8efd5d539bacb4c795d8f0d8100a124d7377da9.jpeg)

Camera angle resets when XR starts

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/6/96f2d4d5fb9363bf98d061670d5ba650b16b4cc9.jpeg)

But what I want is for the XR to pick up the previous camera angle when it starts.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/9/79a86eed4bebfc7f7eacbdf3357642e49c2b204d.jpeg)

Mister Jedi, is that possible?

---

<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 9, 2022, 4:51pm UTC](https://forum.babylonjs.com/t/webxr-camera-rotation-position-and-old-camera-rotation-position/31163/5 "2022-06-09T16:51:26Z")

</div>

That should be the default behavior. Or better yet - that is the default behavior 🙂

The default behavior is to take the position of the desktop camera and the rotation on the y axis when entering XR. if that’s not the case please try reproducing it and show us when it doesn’t work.

Note that you are overriding this behavior when you set the camera’s position on your own.

If I misunderstood, please try me again 🙂

---

<div class="post-metadata">

**Author:** ![farukcelim](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/farukcelim/32/27134_2.png) [@farukcelim](https://forum.babylonjs.com/u/farukcelim)\
**Post date:** [June 10, 2022, 2:55pm UTC](https://forum.babylonjs.com/t/webxr-camera-rotation-position-and-old-camera-rotation-position/31163/6 "2022-06-10T14:55:55Z")

</div>

The information you provide is valuable to me, thank you for sharing your information. Actually, that’s exactly what I wanted. Getting both the position and rotation of the old camera after opening the WebXR screen. He’s just taking his position now. How can I change the direction the WebXR camera is facing when WebXR is turned on?

---

<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 10, 2022, 3:21pm UTC](https://forum.babylonjs.com/t/webxr-camera-rotation-position-and-old-camera-rotation-position/31163/7 "2022-06-10T15:21:23Z")

</div>

This happens automatically. The rotation on the Y axis is applied to the webxr camera when you enter XR in VR mode.

If it doesn’t I will be happy to check a reproduction. On the playground would be the best 🙂
