Setting scene.audioListenerPositionProvider to null throws an error

Hi!

I’m working on a project that lets the user switch back and forth between 1st person view and 3rd person view. I’m implementing sound on objects, and I need to set the audioListenerPositionProvider based on whether the user has selected 1st person or 3rd person view.

From what I read on Audio | Babylon.js Documentation, it should be possible to set the audioListenerPositionProvider to null when the user selects 1st person mode to go back to using the active camera as the listener. But doing so leads to an error being thrown, as can be seen here - https://playground.babylonjs.com/#CBGEQX#1612

It seems like a bug, but am I doing something incorrectly here?

You are correct. It is a bug.

Fix is here: https://github.com/BabylonJS/Babylon.js/pull/13864.

Thanks for reporting this!

1 Like

Thanks for the quick fix :slight_smile:

I have another thought, that the same bug probably applies to the audioListenerRotationProvider setter as well.