Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: heavygunner on October 26, 2019, 07:54:10 PM

Title: Listen audio only when camera visible
Post by: heavygunner 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
Title: Re: Listen audio only when camera visible
Post by: rechronicle 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)
Title: Re: Listen audio only when camera visible
Post by: djaydino 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.