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

PositionalAudio breaks in webxr when moving the user #22884

Closed
praedeth opened this issue Nov 26, 2021 · 9 comments · Fixed by #22362
Closed

PositionalAudio breaks in webxr when moving the user #22884

praedeth opened this issue Nov 26, 2021 · 9 comments · Fixed by #22362
Labels

Comments

@praedeth
Copy link

Adding THREE.PositionalAudio to a mesh inside a group (Object3D or Group) alongside the user (camera) works as expected, but if the group is then moved the audio breaks.

To Reproduce

Steps to reproduce the behavior:

  1. create a container to hold the "vehicle"
  2. create and add a webxr "user" to the container
  3. create an AudioListener and add it to the camera
  4. create and add a PositionalAudio to the container
  5. move the container "vehicle"

Code

let carContainer = new THREE.Object3D();
scene.add(carContainer);

// create a "user" so that the webxr camera moves with the carContainer
let user = new THREE.Group();
carContainer.add(user);
user.add( camera );

// create an AudioListener and add it to the camera
const listener = new THREE.AudioListener();
camera.add( listener );

function tick() {
carContainer.position.z += 0.01;
}

Live example

(for some reason the fiddle doesn't show the VRButton button. I don't use jsfiddle much sorry...)
https://jsfiddle.net/mayamoss/zgj5cvpk/90/

Expected behavior

Audio follows the user in local(sic) space.

Platform:

  • Device: Oculus Quest 2
  • Browser: Chrome
  • Three.js version: dev
@Mugen87
Copy link
Collaborator

Mugen87 commented Nov 26, 2021

the audio breaks.

Can you please describe in more detail what "breaks" means? According to your expected behavior, I assume the positional audio just keeps its transformation in 3D space. Or do you experience some sort of the audio stutter or cracks?

@praedeth
Copy link
Author

"Breaks" in this case means "goes weird", "glitches out", "crackles", "distorts"... Sorry!

@Mugen87
Copy link
Collaborator

Mugen87 commented Nov 26, 2021

Can you please apply #22362 to your app and see if it solves the issue?

@arpu
Copy link

arpu commented Nov 26, 2021

we have the same problem with newer webxrManger , using webxrManger from r129 in three r134 works

@arpu
Copy link

arpu commented Nov 26, 2021

@arpu
Copy link

arpu commented Nov 26, 2021

can confirm apply #22362 to r135 fixed it

@praedeth
Copy link
Author

I don't know what I'm doing wrong but it's still glitching (crackling) for me when I move the container even with r135 + #22362...
I'll simplify my example to try and get to the bottom of it and report back...

@remmel
Copy link
Contributor

remmel commented Jan 3, 2022

On my oculus quest 2, also got that crackled sound problem introduced in Threejs 0.130 and still present in 0.136 (and all versions between). Everything is fine on 0.129

@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 3, 2022

r130 introduced #21964. AFAICS the related changes to WebXRManager are the root cause of this issue. #22362 should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants