playMaker

Author Topic: Listen audio only when camera visible  (Read 1604 times)

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Listen audio only when camera visible
« on: October 26, 2019, 07:54:10 PM »
Hello !

building a TD game. Sound is playing when towers started to fire. Player can move the camera and see other areas of map. what i want is, mute the tower firing sound when the tower became in-visible to camera.  i mean, when i move to other part of map , i don't want to listen the firing sound.

Thanks

rechronicle

  • Full Member
  • ***
  • Posts: 119
  • Mystvaldia
    • Indie RPG Creator
Re: Listen audio only when camera visible
« Reply #1 on: October 26, 2019, 11:15:01 PM »
Hello,

I think you can use the TRIGGER action (make the area the same size as the camera view) and Audio Mute action to set ON when the tower is entering/visible & OFF when the tower is exiting/not visible. Checking whether the listener is around to hear the sound.

Or using Min&Max distance to control how far the sound can be heard by Audio Listener component. This is somewhat similar to how Warcraft skirmish handle the audio that fading away as the camera goes.


I'm interested to learn if there's another way to do this.
Cheers,
rechronicle  8)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Listen audio only when camera visible
« Reply #2 on: October 27, 2019, 10:23:06 AM »
Hi.
There is also an action called 'Game Object Is Visible'

But using the 3d Sound Settings on the audio source might be better.