Version
menu_open
Wwise Unreal Integration Documentation
Integrating Footstep Sounds

Posting a Wwise Event and Setting a Switch Based on Animation Notifications - PostEvent | SetRTPC

A common scenario in game productions is posting footsteps sounds. This is primarily done in games with a character who has actual feet, but this section will demonstrate a method that’s not limited to footsteps. We will post a sound from a specific time in an animation, which is an approach you can use for many other things, such as an animation of a door opening.

As in previous sections, we'll use the ThirdPersonCharacter project. This project includes a Mannequin (playable character controller) with input controls and animations. To integrate footstep sounds, we'll add Animation Notifications to an animation of the character running. A Blueprint will receive those notifications and post the sound.

  1. Open the ThirdPersonRun animation found in the Content Browser's Content > Mannequin > Animations folder.

  2. In the Animation timeline at the bottom, select the moment when the right foot starts to make contact with the ground.

  3. In the Notifies timeline, right-click, and select Add Notify > New Notify.

  4. Name it “Footstep” and press Enter.

    Setup of the right foot notification is complete, but you should consider repeating this setup for the left foot. Next, let's connect the notification to a Post Event function.

  5. From the Content Browser, open the ThirdPerson_AnimBP.

  6. In the Event Graph, right-click in an empty space and choose the Event starting with AnimNotify_ followed by the name of the Notification.

  7. Post the event like in previous sections and reference the Actor, which you can get using the GetPlayerCharacter 0 variable.

    The setup described here is sufficient to play footstep sounds, however, it does not take into account the type of material underfoot. This is covered in the following section using Switches.

Setting a Surface Switch

To control which sound is played when calling the Footstep Wwise Event, you can use Switches. Before starting, some setup is necessary in Wwise. As shown in the following figure, create a Footstep Switch Container that includes two Random Containers; one for Dirt and one for Grass.

Since we haven't set up any logic for detecting the surface underfoot, setting the Switch may not be a straightforward task. Considering that this may be the job of a programmer or game designer on your team, we won’t go into the details of developing such a system. Just know that this system is based on using Unreal's Physical Surface definitions. In the Unreal Editor, you can define your own surface types in Project Settings > Physics, and assign it to a Mesh in Details > Collision > Phys Material Override.

  1. When the AnimNotify_Footstep is notified, you'll need to check for the surface below the player. To do so, you can use the LineTraceByChannel function, which needs a Start and End location for the trace.

  2. If the trace finds anything below the player, we can then route the signal to the correct Set Switch function, and lastly post the Event.

Note:
It's important to set the Switch on the same Actor as the Event, otherwise the Wwise Event won't be aware of the Switch change.

Here's an overview:

To test your design, duplicate the surface below the player. Assign different materials to each side, as shown. Listen to the result when the player walks from one surface to the other.

Note:
To assign a Material, you have to create one first. Do so by right-clicking in the Content Browser > Physics > Material, open it up and set the Physical Properties > Surface Type to the desired surface type specified in your settings.

Refer to this video for a walkthrough of setting a Switch in Unreal.


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