BabylonJS left handedness and WebXR

Hi guys,

nice to see you all again, I have a small question regarding BabylonJS left handedness with WebXR.

I’m having a situation right now, where I load a scene from a gltf file and then I append another asset from another file into the same scene to use it as an AR cursor for hit test positioning afterwards. The problem is that when I enter the XR mode, the initial scene objects look and behave correctly, but the cursor moves the opposite direction from the phone movement. I.e. when I turn the phone left it moves right and vice versa. The scene objects look good when positioning, but when I attach them to an anchor they look mirrored and are shown from the back. Also, after exiting the XR mode the scene objects look mirrored.

When I use scene.useRightHandedSystem = true; and invert the camera position, the scene objects look good (not mirrored) before and after the XR mode, and in the XR mode the AR cursor behaves well then (following the camera as it should, not the opposite direction), and the scene objects look good during the position and on an anchor attaching, but they are badly positioned, like much closer to the camera as if their pivot was somewhere behind them.

I guess it’s something to deal with BJS and WebXR implementations of coordinate systems differences, but I’m really confused with how to solve it better. Maybe you will have an advice or a good proven method to deal with it? How would you recommend to solve these issues better?

Thank you!

Adding our own XR expert @RaananW :slight_smile:

Hi @artteq,

This should all be taken care for you internally, and if it doesn’t, we need to solve this.

Would you be able to reproduce the issue on the playground so I can test it and understand exactly what’s happening?

Hi Raanan,

thank you for the feedback. I’ve thoroughly investigated the issue and found out that the problem was in the model itself. So for now everything works okay with scene.useRightHandedSystem = true; and inverted camera, so nothing to worry about.

Thank you and sorry for disturbing

1 Like