How to fixed a mesh as a control in webXR?

These are in normal mode:

How can I fixed the box like above in webXR, and this is what I am doing but not succeeding :

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 :

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