# How to fixed a mesh as a control in webXR?

**URL:** <https://forum.babylonjs.com/t/how-to-fixed-a-mesh-as-a-control-in-webxr/18147>\
**Category:** Questions\
**Tags:** tutorial\
**Created:** [February 4, 2021, 8:45am UTC](https://forum.babylonjs.com/t/how-to-fixed-a-mesh-as-a-control-in-webxr/18147 "2021-02-04T08:45:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LePhanTanLoc](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lephantanloc/32/13803_2.png) [@LePhanTanLoc](https://forum.babylonjs.com/u/LePhanTanLoc)\
**Post date:** [February 4, 2021, 8:45am UTC](https://forum.babylonjs.com/t/how-to-fixed-a-mesh-as-a-control-in-webxr/18147/1 "2021-02-04T08:45:51Z")

</div>

These are in normal mode: [https://www.babylonjs-playground.com/#1IG874#55](https://www.babylonjs-playground.com/#1IG874#55)

How can I fixed the box like above in webXR, and this is what I am doing but not succeeding : [https://playground.babylonjs.com/#4HUQQ#1094](https://playground.babylonjs.com/#4HUQQ#1094)

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [February 4, 2021, 9:32am UTC](https://forum.babylonjs.com/t/how-to-fixed-a-mesh-as-a-control-in-webxr/18147/2 "2021-02-04T09:32:09Z")

</div>

pinging XR master @RaananW

---

<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:** [February 4, 2021, 10:14am UTC](https://forum.babylonjs.com/t/how-to-fixed-a-mesh-as-a-control-in-webxr/18147/3 "2021-02-04T10:14:24Z")

</div>

I will always recommend to never detach the webxr camera or manipulate its transformation without a user action. Also, WebXR has an internal restriction - only one camera can be rendered. So you can’t use the layer masks like in the other example.

As the WebXR camera is actually a node, you can use it to parent a box to it. There will be a small issue with rotation, but I am not sure what you are trying to achieve exactly. Try parenting, and if rotation behaves incorrectly, try only copying the position and the y component of the rotation. This will be the same as the demo you shared.

---

<div class="post-metadata">

**Author:** ![LePhanTanLoc](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lephantanloc/32/13803_2.png) [@LePhanTanLoc](https://forum.babylonjs.com/u/LePhanTanLoc)\
**Post date:** [February 5, 2021, 3:10am UTC](https://forum.babylonjs.com/t/how-to-fixed-a-mesh-as-a-control-in-webxr/18147/4 "2021-02-05T03:10:02Z")

</div>

> [@RaananW](#):
>
> copying

How to I can copy the y component of the rotation, it always is 0, I checked it by printing it out : [https://playground.babylonjs.com/#4HUQQ#1105](https://playground.babylonjs.com/#4HUQQ#1105)

---

<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:** [February 5, 2021, 9:14am UTC](https://forum.babylonjs.com/t/how-to-fixed-a-mesh-as-a-control-in-webxr/18147/5 "2021-02-05T09:14:57Z")

</div>

The camera is using a quaternion, so the .rotation will always be 0. You will have to convert the quaternion to euler values and take the y component from there.

Something along the lines of this:

[planet | Babylon.js Playground](https://playground.babylonjs.com/#4HUQQ#1172)

---

<div class="post-metadata">

**Author:** ![LePhanTanLoc](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lephantanloc/32/13803_2.png) [@LePhanTanLoc](https://forum.babylonjs.com/u/LePhanTanLoc)\
**Post date:** [February 8, 2021, 4:04am UTC](https://forum.babylonjs.com/t/how-to-fixed-a-mesh-as-a-control-in-webxr/18147/6 "2021-02-08T04:04:11Z")

</div>

I am sick so I have to respond today, this is what I want, thank master @RaananW.
