Sound: spatialSound and maxDistance after load have no effect

Hey,

I was experimenting with the Sound API and for some reason (one particular use-case we have), we need to switch a sound element from spatialized to ambient (and the other way around) while it’s being played. Turns out it doesn’t always work, though I’m not sure 1. we attempt to do it properly 2. if it’s an officially supported scenario.

Here’s a demo with steps to repro: https://www.babylonjs-playground.com/#PCY1J#107

In the same fashion, it seems like maxDistance value changes are not taken into account while the media is playing.

Then here’s another question: attachToMesh enables spatialization of the sound, what is the expected result when setting spatialSound to false while keeping the sound attached to the mesh?

Have a nice day! :slight_smile:

Hey Thomas :wink:

As the system needs to build a new audio graph the best idea is to stop the current sound and spin a new one with the new configuration

Roger! That’s what I ended up doing anyway, though I wanted to make sure I wasn’t missing anything just in case. Thank you David!

1 Like