Positional Audio is not playing correctly

Hi there, I’m having an issue with positional sound not playing properly.

I have an audio listener on the camera which is 3 units away from origin. I have a sound component on an entity that is moving 25 units away from origin.

I’ve setup the sound component with positional = true, refDistance 3.0, maxDistance 30.0, rolloff factor 1.5

My expectation is when the entity moves closer to max distance there will be some falloff with the sound volume. In my test example the audio doesn’t change.

https://playcanvas.com/editor/scene/2392263

This is my first time setting up positional audio so hoping someone can help direct me. Thanks.

Noah

Hi @noah_mizrahi!

I don’t think your script is working as expected, because you’re setting the references on the slot while they are only available on the sound component itself.

If you apply your settings directly to the component, it should work as intended.

Hi @noah_mizrahi,

Also, just to make sure, with the above, are you clicking the screen to unlock the audio context? Browsers typically block sounds form autoplaying without interaction from the user.