Skip to content
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: Fix XRCamera Local Space Behavior by Reverting #21964 #22362

Merged
merged 1 commit into from
Aug 16, 2022

Conversation

zalo
Copy link
Contributor

@zalo zalo commented Aug 18, 2021

Fixed #23597.
Fixed #22884.

This PR fixes a bug introduced in r130 by reverting how XR Camera calculations handle local space (by partially undoing #21964 (which appears to conflate matrixWorld and matrix)).

This enables the XR camera to be parented to another moving object without odd behavior once again.

If this isn't the correct fix; I'd be happy to test alternatives in the context of my application.

Related issues: #21964 , https://github.com/google/model-viewer/pull/2464/files#r647866462

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.
@zalo zalo changed the title WebXRManager: Fix Camera Local Space by Reverting #21964 WebXRManager: Fix XRCamera Local Space Behavior by Reverting #21964 Aug 18, 2021
@mrdoob
Copy link
Owner

mrdoob commented Aug 19, 2021

Apologies, I should have written the reasoning in #21964.

It has been just 2 months and I've already forgotten... @elalish do you remember what it was?

@mrdoob mrdoob added this to the r132 milestone Aug 19, 2021
@elalish
Copy link
Contributor

elalish commented Aug 19, 2021

#21964 (comment)

@zalo
Copy link
Contributor Author

zalo commented Aug 20, 2021

@elalish Apologies for the delay, I just re-added the decompose from the prior PR so the cameraVR's position/rotation/scale should be synced with its own matrix.

However, given that the cameraVR operates outside of the scene hierarchy, does it make sense to sync the cameraVR and scene camera's worldMatrix data directly?

@mrdoob mrdoob modified the milestones: r132, r133 Aug 26, 2021
@mrdoob mrdoob modified the milestones: r133, r134 Sep 30, 2021
@mrdoob mrdoob modified the milestones: r134, r135 Oct 28, 2021
@DePasqualeOrg
Copy link

DePasqualeOrg commented Oct 30, 2021

This appears to fix the bug I referenced here: #21964 (comment)

@DePasqualeOrg
Copy link

Any chance this could get included in the next release? My VR apps have not been working properly for months because of this bug.

@mrdoob mrdoob modified the milestones: r136, r137 Dec 24, 2021
@mrdoob mrdoob modified the milestones: r137, r138 Jan 26, 2022
@DePasqualeOrg
Copy link

Since this has already been approved, could we pull it into the next release? VR apps with a parented camera haven't been working properly for about half a year now.

@LeviPesin
Copy link
Contributor

Wow! Can you please share its code?

@mrdoob mrdoob modified the milestones: r140, r141 Apr 30, 2022
@kalegd
Copy link
Contributor

kalegd commented May 18, 2022

+1, I think 9 months is a good amount of time for this pull request to have gestated (I say this with only humorous intentions without animosity)

1 similar comment
@kalegd
Copy link
Contributor

kalegd commented May 18, 2022

+1, I think 9 months is a good amount of time for this pull request to have gestated (I say this with only humorous intentions without animosity)

@ashconnell
Copy link
Contributor

This issue has been resolved for quite some time now

@LeviPesin
Copy link
Contributor

@ashconnell When and where was it fixed?

@msub2
Copy link

msub2 commented May 19, 2022

@LeviPesin I think he means to say there's been a consensus on this for months that it's good to go and yet it hasn't been merged in yet. Scrolling up through issues mentioning this you can see that this fix does indeed fix it for people.

@mrdoob mrdoob modified the milestones: r141, r142 May 26, 2022
@ashconnell
Copy link
Contributor

ashconnell commented May 27, 2022

@LeviPesin Apologies. I meant this should be merged as there are no objections.

I can also verify this PR does indeed fix the crackling PositionalAudio issues in WebXR, and would be delighted to decomission my fork once this is merged :)

@mrdoob mrdoob modified the milestones: r142, r143 Jun 29, 2022
@ashconnell
Copy link
Contributor

Is there an issue with this PR? It keeps getting pushed back but seems like a trivial merge.

@zalo
Copy link
Contributor Author

zalo commented Jul 1, 2022

I suspect it's waiting for an example or test that would break (in the case that this functionality gets broken again at some point in the future...)

@DePasqualeOrg
Copy link

Plenty of things have been broken for nearly a year because of this.

@cktben
Copy link

cktben commented Aug 10, 2022

Please go ahead and merge this. It fixes a number of problems that just can't be worked around without it.

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 10, 2022

@elalish Would it be a problem for model-viewer if this PR gets merged?

@elalish
Copy link
Contributor

elalish commented Aug 10, 2022

@elalish Would it be a problem for model-viewer if this PR gets merged?

I don't think so. Our usage of XR is pretty vanilla, so I'd expect what's good for others is good for us too.

@mrdoob mrdoob merged commit 777f97a into mrdoob:dev Aug 16, 2022
@mrdoob
Copy link
Owner

mrdoob commented Aug 16, 2022

Thanks!

@mrdoob
Copy link
Owner

mrdoob commented Aug 16, 2022

@zalo

I've got a cool three.js OpenXR demo waiting in the wings that could use this PR...
LeapShape Cylinders
LeapShape Hollowing

That looks amazing! 🤩

@zalo zalo deleted the revert-21964 branch August 16, 2022 20:15
abernier pushed a commit to abernier/three.js that referenced this pull request Sep 16, 2022
…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.
snagy pushed a commit to snagy/three.js-1 that referenced this pull request Sep 21, 2022
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet