Tag: sound scripting

To have nice ambience of the closed places like room, cave or church you need to set up Reverb Zones. But Unity 3D 4.x provides only spherical shaped Reverb Zones which doesn’t fit into a box. In order to have such a place nicely filled with the reverberation we need to use triggers to switch it on and off when the player enters the area.

Setup of Reverb Zone and Trigger for Barrack 1.

For simple shapes it is efficient to use Box Colliders. But there is another problem – do not cut reverb aburptly when player steps out the trigger. It is better to use simple scripting to smoothly fade out a reverb zone when OnTriggerExit occurs.

Listen to three cases in the scene below:

Barrack 1 uses a bit tricky positioned and tight setting for minDistance and maxDistance parameters of Reverb Zone to fade reverbation right before entrance. Not to flexible but useful sometimes.

Barrack 2 fades amount of reverb for a short period of time before switching it off. Simple smoothing can be easely spotted.

Barrack 3 fade bases on Players distance from the entrance. If the Player change his mind right after stepping out of the Barrack to go back, the reverb doesn’t disappear completely. In this example it is checked only on the exit, to preserve some CPU but you can do in both ways ofcourse.

Examples 2 and 3 operate on the single Reverb Zone parameter.

Controls: WASD + Mouse look. Small icon on the right bottom corner to fullscreen. About 5MB data to go. Unity Web Player is required.

Update info (06.2017): due to policy changes and lack of updates on Unity side, online example seems not to work in any of current browsers. Sorry. There is movie instead.
[unity src=”717″]