|
Post by pixelknight on Oct 24, 2019 19:09:49 GMT
Hi there,
Been using master audio for a while and loving it, but on my most recent project I'm running into a little issue I can't seem to get resolved, well, not elegantly anyway.
I have a racing game, top-down, all good, it has local multiplayer and when the players split up from each other the camera zooms out so you can still see all players on screen. However the issue with this is that once the camera zooms out you no longer get to hear the cars. Yes I could set the distance template to something like 20000 and that solves it, great... not quite.
Also in the game are bot controller versions of the player cars, exactly same gameobjects just not controlled by humans, what I don't want is their engine noises being at same sound (same goes for collision sounds), so I was hoping there'd be a way for me to adjust the distance setting for the playing instance of a sound based on whether I know it's a player or not. I've searched and searched but I cannot find a way to adjust distance at runtime from the PlaySoundResult I get back from PlaySound3DFollowTransform. Am I missing something obvious here at all? Any help wold be gratefully appreciated.
Thanks in advance
|
|
|
Post by DarkTonic Dev on Oct 24, 2019 21:30:00 GMT
minDistance and maxDistance are properties on the Audio source itself, which you can get to from the playing Variation if you play the sound from code.
var soundPlayed = MasterAudio.PlaySound3DFollowTransform("Engine1X", this.transform); if (soundPlayed.ActingVariation != null) { soundPlayed.ActingVariation.VarAudio.maxDistance = 100f; }
Something like the below should work.
|
|
|
Post by pixelknight on Oct 25, 2019 10:08:38 GMT
Ah that works, thank you so much, not sure how I missed that ActingVariation Many thanks
|
|
|
Post by DarkTonic Dev on Oct 25, 2019 15:28:59 GMT
No problem.
|
|