question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PositionalAudio breaks in webxr when moving the user

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
arpucommented, Nov 26, 2021

can confirm apply #22362 to r135 fixed it

2reactions
praedethcommented, Nov 28, 2021

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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Positional audio stuttering (Using Omnitone & Resonance ...
Here are some issues I believe could be linked with mine : PositionalAudio breaks in webxr when moving the user · Issue #22884...
Read more >
Web audio spatialization basics - Web APIs - MDN Web Docs
When we move the boombox, the sound it produces changes accordingly, panning as it moves to the left or right of the room,...
Read more >
The Design of an Experiment to Evaluate the Effect of Spatial ...
The experiment uses an immersive, web-based platform exploiting the WebXR application programming interface, and built using Three.js and ...
Read more >
Audio | Babylon.js Documentation
So, to use our sound engine, you need to use a Web Audio compatible browser. Still, if you're using it on not compatible...
Read more >
Bang on A (Virtual) Can: A Primer on A-Frame Audio
This means we get things like positional audio, volume control and audio playback out of the box, as soon as we use an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found