Version

menu_open

Setting up a Game Parameter

We can get information about the game object's proximity to the player from the game engine and use it through a new game parameter called Distance_to_Player throughout the project.

Setting up the Distance_to_Player game parameter

It's easy to get distance info and other values directly from the Wwise audio engine. You can subscribe to a built-in value for the distance between the listener and the game object from a list of built-in values calculated inside of the audio engine using the "Bind to Built-In-Parameter" drop-down menu.

Binding the Built-In Distance value to the Distance_to_Player Game Parameter

The following built-in parameters are calculated by the audio engine and are available to be bound to game parameters:

  • Distance - Distance to game object.

  • Azimuth - Horizontal angle.

  • Elevation - Vertical angle.

  • Emitter Cone - Angle between object's orientation and the listener.

  • Occlusion - As set by the game on the game object.

  • Obstruction - As set by the game on the game object.

  • Listener Cone - Angle between listener's orientation and the emitter.

Interpolation can be used to apply a kind of "smoothing" to the values sent by the audio engine. The modes (other than None) let you modify the rate (in Units) or time (in seconds) when target values go upward (Attack) or downward (Release). Adding an Interpolation Mode helps keep values from the game engine from "jumping" or "stepping" too quickly which may cause, for example, a voice volume to abruptly increase in volume. The Interpolation properties allow for controlled transitions between Game Parameter values sent from the game or from within the Wwise audio engine.

In this example, the behavior of the Distance_to_Player game parameter is modified using the Interpolation properties available in the Game Parameter Property Editor.

Setting the Game Parameter Interpolation Mode

Interpolation Modes can be set using the Mode drop-down list and include:

  • Interpolation Mode - None: Jump straight to the target value.

  • Interpolation Mode - Slew Rate: Limit the game parameter variation rate to the specified Attack and Release rate. (Units)

  • Interpolation Mode - Filtering Over time: Filter the game parameter current value to target 99.5% of the target value within the specific Attack/Release time. (Seconds)

The Interpolation Mode for the Distance_to_Player Game Parameter will be set to "Slew Rate" with a Attack (in Units) of 50 and Release (in Units) of 50 to produce the desired effect.


Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise