Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

0 votes
Hello!

I've searched around a lot but I can't find anyone talking about this topic.

I'm building character interaction in Unity where I'd like characters to talk to you if you're close and yell if you're far away. Ie, I would like to trigger different voice tracks depending on distance. I don't want to use a blend container, since I don't want to change sound as you move closer. I just want to start the right sound depending on the distance to the target at that moment.

I'm looking for a best practice for this. Is there any nice way to do this in Wwise, or should I code this entirely in Unity and just use Events?
in General Discussion by Petter S. (140 points)

1 Answer

+1 vote
 
Best answer

Hey Petter, 

There's many ways to do this, but this is definitely possible both using Events or by coding.
If you don't need the granularity between far and close, you can make a Switch, and then set the Switch from either...

- An Event that sets the Switch.
Make a Switch with two switches (far and close), assign the Switch in a Switch Container and then right-click the Switch Container > New Event > Set Switch. 

- Or from code like this: 
public Ak.Wwise.Switch Switch_Far;
public Ak.Wwise.Switch Switch_Close;
... and then from a function, use the .SetValue(). Just make sure to set the switch before you post the sound itself, and also on the same game object. 

There's also more on Switches in the Wwise-301 course
If you want to learn more about the differences between States, Switches and Game Parameters, try watching this One Minute Wwise video.

Let us know if this helps!

by Mads Maretty S. (Audiokinetic) (39.8k points)
selected by Mads Maretty S. (Audiokinetic)
Another note. You could also set an RTPC based on the distance, and then connect that RTPC to a switch. This would allow you to control when something is "far" or "close" inside Wwise, instead of inside Unity.
Sorry, never managed to answer this. Tried out the different versions and used most of them at different place. Thank you very much for the suggestions!
...