Audio Bounce
Easy and Lightweight Volumetric 'Occlusion - Reverb - Bounce' system for Unity
After installing the package the required components in the scene are essentially 3: AB_
MainController, AB_ProbeDistributor (or your own version of it) and one AB_AudioSourceRegister on
each AudioSource you wish AudioBounce to handle.
I’ve provided you two prefabs ready to go for the MainController and the ProbeDistributor in “../HSD/
AudioBounce/Prefabs/ “.
The AB_MainController component should be placed roughly where your character “ears” would be
situated. In a first person game it would be the MainCamera, in a third person game like mine it’s
going to be where your character head is (you may try it on the camera as well and see if you like it
better, I don’t ^^), and for a 2.5D game it’s at the center of the screen at the same depth of your
character.
To explain why, here’s a brief walkthrough of what AudioBounce does:
Every Cycle (which is how many frames long you want it to be for your game, 32 frames by default so
twice a second in a 60fps game) the MainController’s brain (AB_Locator) is going to take every single
AudioSource with an AB_AudioSourceRegister component in range and calculate if there’s a path
from the sound to the player “ears” and it handles each one separately by adjusting how much
occlusion that sound has, if it bounces on a surface before reaching the player and also how much
reverberation needs to be applied to that sound.
Be sure to set the MainController RayCast Layer mask correctly to hit your environment and not your
Player Character (probably also your enemies unless you want them to be able to block your audio,
maybe you have a WALL monster… if you do that’s awesome!).
The AB_ProbeDistributor is the component that’s going to map in a volumetric way the scene around
the player and it provides a set of points where the Audio is allowed to bounce off to reach the Player.
This is one possible solution and it’s highly customizable in a huge variety of ways such as shape,
number of probes and complexity, to allow you to make something that suits your needs for your game
and the character your player is controlling. It also comes with a prefab you can just place in your
character (be sure to set the Raycast Layers correctly in here). AudioBounce also comes with a
barebones Distributor class in case you wish to make your own… it’s not an easy task but there might
be cases where you might want to do that, the only case it comes to my mind is for a fixed camera
third person game like old school Resident Evil where probably a Prebaked Probe Distributor with a
list of probes that you can load per scene (or camera angle) might be preferred to save computational
cost. If it were me I would just put the ProbeDistributor where the camera is for each scene and have it
realtime and save me a lot of headache but you’re free to do what you want! :D (let me know if you
do!)