How to fixed a mesh as a control in webXR?

These are in normal mode: 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

pinging XR master @RaananW

1 Like

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.

1 Like

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

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

1 Like

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

1 Like