- Home /
Disabling sound coming through walls
Hey, I have a problem with sounds and solid walls. I couldn't find an answer on the web and thought to ask here. Here we go:
Red lines = walls
S = sound source
Green circles & arrows indicate the sound distribution in the room.
P1 is a point where the player can be. Here the player can hear the sound normally.
P2 is another point where the player can be. But other than at P1, the player shouldn't be able to hear the sound at P2 with the same volume as P1 can, because there is a wall between the player and the sound now.
I found that unity ignores walls which is a pity. If I want a monster to hide in one room the player shouldn't be able to her it when he is outside the room, next to the wall where the monster is.
Answer by DaveA · Jun 29, 2013 at 06:20 PM
My add-on Audio Brush addresses this directly. It will be available as soon as I get the licensing in place. If you would like to test it though, contact me through the web site. http://qlcomp.com click on Unity then Audio Brush
Answer by Eric5h5 · Jun 29, 2013 at 09:48 PM
A basic way is to use a linecast to check if a collider is in the way between something that generates the audio and the player. There's no way for Unity to do this automatically, since lots of sounds should still be audible through walls, depending on the material and thickness, so it's up to you to decide how you want to handle audio damping based on your conditions.
Thank you. I'll try to get it working how I want it to be with Linecast then.
Your answer
![](https://koobas.hobune.stream/wayback/20220613105136im_/https://answers.unity.com/themes/thub/images/avi.jpg)