Footsteps Audio
The BPC_M2Example_FootstepsAudioComponent is our example implementation of adding sound effects when characters take footsteps, or land after being airborne.
Summary of the implementation
Linking footstep audio to our animations
Each of our animations with footsteps triggers a notify: AnimNotify_Audio_MovementSystem

The bone associated with the footstep (used to determine left vs right foot), and the "audio movement state" (i.e. whether the footstep is a regular step vs landing after a jump etc.) are passed in to the notify.
These notifies are then passed to any components on the animated actor that implement BPI_Footstep_Listener, triggering NotifyFootstep - both the BPC_M2Example_FootstepsAudioComponent and the deprecated BPC_Audio_MovementSystem implement this. These components then determine what sound effect to play (see the section below)
Handling different audio based on terrain
Responding to the NotifyFootstep event, the BPC_M2Example_FootstepsAudioComponent uses a line trace to determine what physics material is underfoot.

We use this physics material to map to a footsteps sound asset, via the FootstepSoundsDataAsset property in the component. This maps to a data asset which contains a map, along with a default sound for when we are using an unknown physics material.

If you want to add more physics materials to the list, or swap out the sounds used, you can replace the FootstepSoundsDataAsset with your own BP_M2Example_FootstepSounds Data Asset. We recommend copying one of the existing A_M2Example_Foley_Footsteps_[X] assets as a starting point, and swapping out the Sounds_[Y] arrays inside
"Land" sounds vs "Moving" sounds
For each material, we want the sound played when landing after a jump to be different to regular footsteps. Therefore, we pass in whether the NotifyFootstep was from a "Land" notify or not into the sound. Our sound sources use this to determine what sound to play.
See A_M2Example_Foley_Footsteps_Grass for an example.

In our basic example, the only different "movement states" we care about are "Land" vs the rest (movement related states, i.e. walk, jog, sprint)

I was using the now deprecated BPC_Audio_MovementSystem. Anything to be aware of?
The new stripped down example BPC_M2Example_FootstepsAudioComponent is similar to the now-deprecated BPC_Audio_MovementSystem, but has some changes to be aware of:
The "wind audio" has been separated out into
BPC_M2Example_InAirWindAudioComponent. If you want the wind noise playing while airborne, you can add this component too.The physics material-to-audio source mapping, and the audio sources themselves have been modified - see Handling different audio based on terrain. The old data table approach (i.e.
DT_M2_Audio_FootstepSounds), and the old audio cues with integerMovementStatewill not be compatible. If you want to use the old system, we recommend making local copies of the deprecated assets, and using those.Our example footsteps component doesn't pitch shift footsteps based on the actor's size. The old logic from
BPC_Audio_MovementSystem::BindMorpheusEventscould be copied across to your own implementation if desired, but we recommend using the new resizing component, outlined in Resizing.Our example has a more limited physics material-to-sound source mapping. If your project has materials that you need audio for, you can add them as outlined above in Handling different audio based on terrain
Last updated
Was this helpful?

