Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to create audio zones/areas?

Discussion in 'Audio & Video' started by toreau, Mar 12, 2015.

  1. toreau

    toreau

    Joined:
    Feb 8, 2014
    Posts:
    204
    Hi!

    I'm in the process of creating a multiplayer FPS which takes place on an island. I'm having problems deciding on the best way of creating audio "zones" (or "areas"). Example: I want the player to hear more and more "ocean sounds" the closer he/she gets to the ocean.

    What I've already figured out is to always measure the distance to the nearest shoreline, but because of the size of the map it's impossible - well, at least not very desirable :) - to have thousands of audio sources placed along the shoreline.

    One solution I've been thinking about is to have an OceanAudioSource on the player itself, and only enable it for the local client, and then adjust its volume depending on the distance to the ocean. But as I'm an audio-n00b I wanted to hear with more seasoned people before starting working on this.

    Thanks in advance for any hints!
     
  2. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
    Your ambient sound is basically omnipresent, so I think it doesn't make much sense to use audio sources that are not centered on the player.
     
  3. toreau

    toreau

    Joined:
    Feb 8, 2014
    Posts:
    204
    So, if I understand you correctly, my approach is "OK"?
     
  4. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
    I would say so, yes.
     
  5. toreau

    toreau

    Joined:
    Feb 8, 2014
    Posts:
    204
    I also thought it was an OK idea, but then I run into problems when I'm inhouse, and the walls doesn't deflect the "outside" sound. :(
     
  6. autobr

    autobr

    Joined:
    Feb 7, 2022
    Posts:
    3