- Home /
AudioSource from mesh instead of one point
Hello,
I've got a problem using AudioSource. My issue is that it seems to be impossible to have the sound emit from a specifically defined area, like a mesh, rather than one point.
I'll clarify this with an example. I want to make a wall emit a sound with a steep rolloff. Only if someone is close to the wall should the sound be heard, but since it's a long wall, you can stand close to the wall at the far end, but still far from the AudioSource in the middle, so it cannot be heard.
I actually hoped to get the answer from the (apparantly outdated) Lerpz tutorial, since it has the impound fence that emits a sound, but the same problem appears. I'd rather not attach twelve audiosources to try and somewhat evenly distribute the sound.
Does anyone have a solution I've overlooked? Maybe something like the AudioSource following the player or some neat trick like that?
You'll have to trick it out by moving the audiosource. I would try something like a custom rolloff based on your distance from the wall, but that wouldn't manage distance, so you'll just have to do it the hard way.
Or, alternatively, you could place the audiosource an unrealistic distance away (so that it is at almost infinity), and set up the falloff so that it works perfectly specifically when the player walks near that wall? You'd have to manually turn off the sound when the player walks closer to it (around the wall), of course.
Your last suggestion is worth a try - that's what I'd do.
Let's say the wall's length is in the X axis.
$$anonymous$$ake the audio source match the players' X axis, but limit its movement to the wall length. If the wall is in 0.0 and has a X length of 10, then the audio source moves from -5 to 5. That kind of thing.
If the wall is angled somehow, then it's just a matter of smartly using local vs global coordinates of the player and audio source. =)
Answer by DaveA · May 14, 2012 at 10:25 PM
I have what you need I think. Would you like to be a beta tester? Please see: http://qlcomp.com/?page_id=20 and http://forum.unity3d.com/threads/131056-AudioMapping-Demo-online!-(Visual-Audio-Zone-customization)?highlight=visual+audio+zone and http://forum.unity3d.com/threads/129085-Visual-Audio-Zones-needs-testing-feedback
I am almost ready to put a simple free version on the Asset Store, any testing/comments would be appreciated.
In short: you draw where you want sound. Draw it. Like in Photoshop. Or use Lightmaps. And you can use these images to shape more than just loudness.
Your answer
Follow this Question
Related Questions
AudioSource - Save a Custom Rolloff? 0 Answers
Audio Source Volume not Fading Over Distance 6 Answers
I have a audio source in one scene, I want it to continue when entering next scene 1 Answer
Sound getting deeper 2 Answers
Audio Volume Help 1 Answer