Hi, I’ve noticed an issue with WebXRCamera returning an incorrect getViewMatrix() when using right handed system (RHS) this.scene.useRightHandedSystem = true;
(fyi, we use RHS in our project but I have not tested if the same issue also occurs in LHS)
We’re using WebXR on mobile, Android Chrome.
WebXRCamera position and rotation are correct. (I did a comparison to the values provided by the raw WebXR api - frame.getViewerPose(referenceSpace) which were a matched)
I only noticed this issue when using the WebXRCamera viewMatrix for frustum tests where it was required and noticed that it was producing different results in WebXR and on desktop.
I’ve performed careful checks to spot the difference and have come to the following solution, running a conversion on the WebXRCamera viewMatrix to match what the raw WebXR api returns.
Will look into that later today or tomorrow. Just to be sure - you are referring to the main camera’s view matrix and not one of its rig cameras, right?
I can confirm that the WebXR Camera’s view matrix is incorrect on RHS. I am going to look into the issue of why the actual webxr camera returns an incorrect matrix, but the matrix you should be taking is one of the two rig cameras. They should be correct, as they are the ones being actually used for rendering.
The WebXR camera is just a “dummy” camera, so its view matrix is actually redundant. However, as I am making sure to always synchronize between the first rig camera and the web camera, i should do it in this case as well.
The TL;dr is - try using camera.rigCameras[0].getViewMatrix() instead and let me know if that’s the right matrix.
EDIT - I found the issue (a 180 rotation missing), i’ll fix it, but I want to see if I can find a cleaner solution instead. For now, please use the rig camera’s view matrix (which actually makes more sense, because both cameras have a slightly different view, so if you want to check frustum you might want to check with both, or with the camera that makes more sense)
ok will try, but just to confirm, this is on WebXR Android mobile where there is only 1 camera and I think it would make sense to assume that activeCamera has all the correct data.