resonance-audio / resonance-audio-unity-sdk

Resonance Audio SDK for Unity
https://resonance-audio.github.io/resonance-audio/develop/unity/getting-started
Other
297 stars 38 forks source link

Poor spatialization if listener is scaled in unity #63

Open taridyn opened 5 years ago

taridyn commented 5 years ago

For reference, this is in Unity 2019.1.12 I have included a demo scene at link: https://drive.google.com/open?id=1zhzeQpw67VfHFkX3uztN5hurCrcLJIo-

And a video of the sound distortion here: https://www.youtube.com/watch?v=Gyc2fzxrzII&feature=youtu.be You'll need to wear headphones.

Short version, when the camera object (and listener) is scaled up, the spatializer has this weird hick up when the camera is around 120 degree left or right. To see your self, open the scene, and hit key 1. This will play a sound from behind. Then take the camera, and pan it left or right (just use the editor, i dont have any keys set up), around 120 degrees, you will hear the error. This only happens if the camera is scaled up. If I set scale to 1, it works fine. Let me know if you need any more info.

A fix I found was just to move the listener to a separate game object (that doesn't change scale) and have it just follow the camera, i.e.

void Update()
{
    soundFollower.rotation = camera.rotation;
    soundFollower.position = camera.position;
}

So, not a critical bug, as there is an easy work around, but it took me like 2 hours to track down what the problem was.

JonOlive commented 4 years ago

i suspect this is related to the issue I raised here https://github.com/resonance-audio/resonance-audio-unity-sdk/issues/46 relating to object directivity over a year ago...