Rotating WebXR Camera around World Y Axis not working in BabylonJS 5 anymore

Hi there,

i don’t know if this is a bug or something changed during the BabylonJS Upgrade but we’ve encountered a problem in one of our projects. We were rotating the WebXR camera around the World Y axis to look at a specific object, which was working fine in BabylonJS 4.2. But now we wanted to upgrade our Babylon Version to 5.3 and it breaks. The camera is not only rotating around the world Y axis but also in other axes leading to a tilted horizon/ slanting world causing sickness. Could please somebody check why this is happening or what changed in the new Babylon version? I made a playground link where i reproduced the situation. When you enter it in XR in BabylonJS 4.2.1 it works (camera gets automatically rotated around Y axis every 2.5 seconds to face the sphere). As soon as you change the Version in the playground to 5.3 it’s not working correctly anymore.

Playground Link: https://playground.babylonjs.com/#F41V6N#830

Hope Someone can help and thanks in advance! :slight_smile:

Hey!

Would be great to know what “anymore” means here. I tried the playground, and it seems to do what is expected - every 2.5 seconds the sphere is in front of you.

You don’t clear your interval, so running this scene a few times might lead to unexpected behaviors. I am using this one - Babylon.js Playground (babylonjs.com)

hi first thanks for the fast anwer :slight_smile:

well i did explain what i mean by “anymore” before. I mean in 5.3 the horizon tilts / world is slanting a little more each time the interval gets called. And it has nothing to do with the interval, this was only for showing the behaviour automatically. We are not using an interval in our real project at all. And yes the sphere is still in front of you. But if you look on the boxes framing the scene, you can see that the horizon tilts.

I was pretty sure it wasn’t, it was just a note at the end of my message :slight_smile:

I’ll try comparing 4.2 and 5.3 to see the differences. Not a lot was done in the webxr camera between those 2 versions, so the only culprit might be an optimization done to the reference space update.

Well thanks for introducing the scene.onDisposeObservable to me. Might come in handy in the future!

Alright i’ll wait for your answer and hope you can find something :slight_smile:

@RaananW hi again. Just wanted to check if you found anything on this topic already :slight_smile: ? The behaviour still seems to be the same with BabylonJS 5.4.0. Or if it can’t be done this way anymore could you maybe suggest another way to rotate the WebXR Camera around World Y Axis to look at a specific point :slight_smile: ?

Sorry, didn’t look into is just yet. Will happen this week for sure

Would that be the expected behavior?:

Babylon.js Playground (babylonjs.com)

It seems like your example doesn’t work on desktop cameras correctly. it might have been that an issue was fixed and this is why it is working as it should right now?

Hi, thank you very much for this alternative solution. It works very well :slight_smile:

1 Like