-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
WebXRManager: Decompose cameraVR.matrixWorld #21964
Conversation
Thanks! |
Looks like this PR causes a bug whenever you move the Camera's parent (because the @elalish I don't fully understand the comment that lead to this; What was wrong with the old method? |
This PR attempts to move XR Camera calculations back into local space by undoing mrdoob#21964 (which appears to conflate `matrixWorld` and `matrix`). This enables the XR camera to be parented to another object again without odd behavior. If this isn't the correct fix; I'd be happy to test alternatives in the context of my application.
The WebXR manager was updating most, but not all of the vr camera state; specifically it was missing the decompose, which forced apps to do it themselves separately (and debugging to figure out what was happening was pretty tricky). I haven't thought about the re-parenting aspect; there may well be a better way, but we should not revert to the old way. |
That is, it wasn’t setting the xrCamera’s position, rotation, and scale? (Was there anything wrong with the normal camera’s transform data?) If the issue was the normal camera, then rather than copying the worldMatrix between the two, would it be acceptable to continue copying only the local matrix (with local pos/rot/scale), but then force the camera to recalculate its world matrix from that and it’s hierarchy? |
Yes, that was the problem.
Maybe? As long as the two cameras' states are in sync, I think I'll be happy. |
I noticed recently that when I exit immersive mode, the location of the camera changes, and when I enter immersive mode again it goes back to where it should be. Could that be related to this issue? This behavior occurs on the VR rollercoaster example, for instance, where the camera is parented. Edit: Pending pull request #22362 appears to fix this bug. |
This PR attempts to move XR Camera calculations back into local space by undoing #21964 (which appears to conflate `matrixWorld` and `matrix`). This enables the XR camera to be parented to another object again without odd behavior. If this isn't the correct fix; I'd be happy to test alternatives in the context of my application.
…b#22362) This PR attempts to move XR Camera calculations back into local space by undoing mrdoob#21964 (which appears to conflate `matrixWorld` and `matrix`). This enables the XR camera to be parented to another object again without odd behavior. If this isn't the correct fix; I'd be happy to test alternatives in the context of my application.
…b#22362) This PR attempts to move XR Camera calculations back into local space by undoing mrdoob#21964 (which appears to conflate `matrixWorld` and `matrix`). This enables the XR camera to be parented to another object again without odd behavior. If this isn't the correct fix; I'd be happy to test alternatives in the context of my application.
Related issue: https://github.com/google/model-viewer/pull/2464/files#r647866462