Author Topic: Trying to figure out proximity to object controls sound volume (or animation)  (Read 1591 times)


  • Junior Playmaker
  • **
  • Posts: 63
    • View Profile
    • Out to Play Interactive
Okay, this may sound odd, but I'm trying to figure out how to control the volume of a sound based on how close I get to it. Obviously Unity is setup for '3D' sounds and does this in one way. But what I'd like to do is have a sound (or sounds), as an audio source on various objects in a scene and as the character gets close to the object, the volume increases.  

I guess the difference is, I'd like to control the distance. For instance, if I were walking along side a walk with an audio source on it, I'd like it to only produce a sound if I came 'real close' to it or in contact with it. so a simple trigger isn't quite enough.  

I guess I could be casting raycasts, but that could get heavy I would imagine.  Any thoughts would be really appreciated.



  • Administrator
  • Hero Member
  • *****
  • Posts: 15494
  • Official Playmaker Support
    • View Profile

 In what way the built in system doesn't work? by simply attaching the audio to the various gameObjects, it will then pick up the right volume. Also, you don't necessary need to have the audio listenr attached to the camera, you can add that component to the player, I think this might be your problem.