three.js icon indicating copy to clipboard operation
three.js copied to clipboard

WebXRManager: Fix XRCamera Local Space Behavior by Reverting #21964

Open zalo opened this issue 3 years ago • 19 comments

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

zalo avatar Aug 18 '21 21:08 zalo

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 avatar Aug 19 '21 13:08 mrdoob

https://github.com/mrdoob/three.js/pull/21964#issuecomment-902074459

elalish avatar Aug 19 '21 16:08 elalish

@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?

zalo avatar Aug 20 '21 22:08 zalo

This appears to fix the bug I referenced here: https://github.com/mrdoob/three.js/pull/21964#issuecomment-955605614

DePasqualeOrg avatar Oct 30 '21 23:10 DePasqualeOrg

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

DePasqualeOrg avatar Nov 23 '21 10:11 DePasqualeOrg

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.

DePasqualeOrg avatar Feb 02 '22 17:02 DePasqualeOrg

@mrdoob I think this PR should be merged.

Mugen87 avatar Feb 26 '22 15:02 Mugen87

Bump

marcofugaro avatar Apr 20 '22 09:04 marcofugaro

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

Note that scene locomotion works by parenting the camera to a parent group :-)

zalo avatar Apr 22 '22 23:04 zalo

Wow! Can you please share its code?

LeviPesin avatar Apr 23 '22 07:04 LeviPesin

+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)

kalegd avatar May 18 '22 22:05 kalegd

+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)

kalegd avatar May 18 '22 22:05 kalegd

This issue has been resolved for quite some time now

ashconnell avatar May 19 '22 13:05 ashconnell

@ashconnell When and where was it fixed?

LeviPesin avatar May 19 '22 13:05 LeviPesin

@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.

msub2 avatar May 19 '22 15:05 msub2

@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 :)

ashconnell avatar May 27 '22 13:05 ashconnell

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

ashconnell avatar Jun 30 '22 23:06 ashconnell

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...)

zalo avatar Jul 01 '22 06:07 zalo

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

DePasqualeOrg avatar Jul 01 '22 08:07 DePasqualeOrg

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

cktben avatar Aug 10 '22 17:08 cktben

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

Mugen87 avatar Aug 10 '22 18:08 Mugen87

@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.

elalish avatar Aug 10 '22 19:08 elalish

Thanks!

mrdoob avatar Aug 16 '22 02:08 mrdoob

@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! 🤩

mrdoob avatar Aug 16 '22 02:08 mrdoob