-
-
Notifications
You must be signed in to change notification settings - Fork 191
fix: use world matrices in getSpaceFromAncestors for XRLayer positioning #477
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
base: main
Are you sure you want to change the base?
Conversation
|
thanks, the PR looks good, but as explained before using "blendTextureSourceAlpha" and transparency as synonym is not correct However, I do not see a reason to change so much: the offset calculation could still happen inside |
e16f043 to
e9f756a
Compare
ac4cd7b to
8af02f1
Compare
Sorry about that it was a zombie commit 🧟 |
|
@bbohlender I think this is ready for your review again. |
packages/xr/src/space.ts
Outdated
| // Calculate offset using world matrices instead of accumulating local matrices. | ||
| // This correctly handles components that override updateWorldMatrix (e.g., UIKit Content). | ||
| if (targetOffsetMatrix != null) { | ||
| targetObject.updateWorldMatrix(true, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be executed in getSoaceFromAncestors or else we would immediately conflict with the requirement
In this function we do not know that targetObject is the child of object but in getSpaceFromAncestors, we know this so executing upateMatrixWorld once is enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for clarifying, I misunderstood what you had said on the previous version.
Move updateWorldMatrix call from getXRSpaceFromAncestorsRec to getSpaceFromAncestors, ensuring world matrices are up to date before traversing ancestors. This correctly handles components that override updateWorldMatrix (e.g., UIKit Content) and satisfies the @requires precondition on getXRSpaceFromAncestorsRec.
8af02f1 to
9f04ac2
Compare
Summary
XRLayers were incorrectly positioned when inside components that override
updateWorldMatrix(e.g., UIKit'sContentcomponent which applies layout transforms likeglobalMatrixandchildrenMatrix).The bug: Compositor layers appeared at wrong positions while fallback meshes rendered correctly.
Root cause: The previous implementation accumulated local matrices via
premultiply(object.matrix), which missed any custom transforms applied duringupdateWorldMatrix().The fix: Switch to using
matrixWorlddirectly after callingupdateWorldMatrix(true, false), ensuring any custom matrix computations are properly reflected in XRLayer positioning.Test plan