-
Notifications
You must be signed in to change notification settings - Fork 3.6k
RH camera fixes #16691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RH camera fixes #16691
Conversation
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/16691/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/16691/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/16691/merge#BCU1XR#0 |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
This change applies the recent right hand camera fixes from PR BabylonJS#16691 to the WebXR camera.
This change applies the recent right hand camera fixes from PR #16691 to the WebXR camera. Test playground: https://playground.babylonjs.com/#4EGO4T#3.
This fixes an issue we have with cameras when in right-handed system where setting `rotation` or `rotationQuaterion` on a camera in right-handed system actually sets the camera 180 flipped from what is represented in the view matrix. You can see this problem using this PG: https://playground.babylonjs.com/#BDQ72M#1 On line 14, we are setting the `rotation` to `0,0,0`, but the rotation from the world matrix of the camera is `0,PI,0`. This change fixes the problem, but it is a breaking change for setting the rotation properties since it will behave 180 flipped from before. The default orientation of camera will still work as before (i.e., always point to +Z for both LH and RH) to maintain backwards compatibility as much as possible. The fix involves changing the reference point of camera. The code mistakenly uses the same reference point of `0,0,1` for both LH and RH view matrix. Babylon target camera's LH and RH view matrices are flipped by Z. Thus, the reference point should also flip by Z for the math to work. There is a secondary problem in `setTarget` where it is hard-coded to use LH math. This has been fixed to consider RH.
This change applies the recent right hand camera fixes from PR BabylonJS#16691 to the WebXR camera. Test playground: https://playground.babylonjs.com/#4EGO4T#3.
This fixes an issue we have with cameras when in right-handed system where setting
rotation
orrotationQuaterion
on a camera in right-handed system actually sets the camera 180 flipped from what is represented in the view matrix.You can see this problem using this PG: https://playground.babylonjs.com/#BDQ72M#1
On line 14, we are setting the
rotation
to0,0,0
, but the rotation from the world matrix of the camera is0,PI,0
.This change fixes the problem, but it is a breaking change for setting the rotation properties since it will behave 180 flipped from before. The default orientation of camera will still work as before (i.e., always point to +Z for both LH and RH) to maintain backwards compatibility as much as possible.
The fix involves changing the reference point of camera. The code mistakenly uses the same reference point of
0,0,1
for both LH and RH view matrix. Babylon target camera's LH and RH view matrices are flipped by Z. Thus, the reference point should also flip by Z for the math to work.There is a secondary problem in
setTarget
where it is hard-coded to use LH math. This has been fixed to consider RH.