- Home /
Make triggered sound audible anywhere
Hi There, I have created a large cube 2000x2000 across the mountain tops of a terrain so that when a Player reaches the cube it triggers the sound of a howling wind. Nice eh, but it doesn't work because it is a 3d sound and the Player is too far from the source. My question is, how can I make the sound audible anywhere in the cube? Here is the code I am using on the cube...The audio source is also on the cube. BTW, the code works fine and is audible on a small 1x1x1 cube.
function OnTriggerEnter(otherObj: Collider){
if (otherObj.tag == "Player"){
audio.Play();
}
}
function OnTriggerExit(otherObj: Collider){
if (otherObj.tag == "Player"){
audio.Stop();
}
}
Answer by aldonaletto · Apr 25, 2012 at 08:27 AM
You can select the sound in the Project view and uncheck 3D - this will make it a 2D sound, which plays the same independently of 3D position. Another alternative is to modify the AudioSource RollOff curve: set start at 2000 and end at 3000, for instance - but you may have problems like the wind sound get almost inaudible when the camera is turned to some specific directions.
Answer by zero84085 · Jul 18, 2012 at 07:42 AM
make the audio listener at the source the audio listener is the ears of the player so you can hear the sound from every where but you cant hear other things so you need to make a script that when the player enter the trigger the audio listener change position after the exit from the trigger make the audio listener go back to player!
Your answer