Apologies if I’m being less than clear. I’m trying to learn a lot here.
- “bad idea™” was meant flippantly, hence ™.
- I’m only using the keyboard to make it easy to set the transformation in the example, it’s not intended for release. It’s not really relevant to the issues I’m trying to resolve.
I am not sure why you say it has no effect, but my guess is that it is due to the keyboard input. What devices are you trying to use?
That’s because I was setting
rotation and not
rotationQuaternion. My mistake, rectified.
xrHelper.baseExperience.camera the correct way to access the XR camera?
Thanks for the “set” tip, I did look for that particular method but couldn’t find it.
= = = = = = = = = = =
The XR camera will take the regular camera’s transformation when entering XR and will copy its transformation to the regular camera when leaving XR. The experience helper does the job for you.
Doesn’t this contradict what your say in point 3?
- The reason that happens is that the camera is attached to the canvas and is constantly recording changes you are making to the original camera (and) on the canvas. … you will need to detach the canvas from the original camera and re-attach it when existing XR:
Simpler, new example to try to illustrate my difficulties more clearly (https://playground.babylonjs.com/#FEX2N2). Switch between XR and normal view without panning or moving the camera. The camera transforms are not copied between views.
Is this correct behaviour? So, I’ll need to set the transform between view changes?
I want the game to be playable in XR and normal views on mobile. At any point the user might switch from XR to normal and vice versa, so the camera transform needs to be preserved between views (as the developer I jump between both views, so preserving the transform would be nice for me, too ).