Search Unity

Audio Sources - Simulate Microphone in-game

Discussion in 'Scripting' started by JohnnyRey, Mar 19, 2013.

  1. JohnnyRey

    JohnnyRey

    Joined:
    Jan 26, 2013
    Posts:
    16
    Hi all,

    I'm trying to simulate an in-game microphone, where you can only hear something if you care looking towards it.

    Right now my solution is to use Raycasts and just lower/mute the audio source when not looking at it, but I was hoping there would be a different way to do this?
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
  3. JohnnyRey

    JohnnyRey

    Joined:
    Jan 26, 2013
    Posts:
    16
    Wow, this is a great suggestion. Thank you! I would like to use a cone system.

    I'm a bit confused by your last line...could you elaborate on what you mean?

    The only advantage I can see with my current system is that I have a nice smooth dropoff in volume when moving the mic away from the source (because I am accessing the source volume and lowering it). I'm not sure how I would do that with your suggestion....any ideas?

    I just want to avoid going from no sound to full sound in a split second.
     
    Last edited: Mar 20, 2013
  4. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190