Posted May 15, 2022 by Arcane Studios
#Reilly da Silva #UE4 #Mythicism #Game Design
This wil be a short and simple tech discussion, but I think the solution I came up is quite useful for anyone wanting to add footstep sounds to their 3rd person game in UE4.
The desired features:
Here is how I made it work:
In order to play the sounds at the right time in the animation, I created an Anim Notify called AN_FootstepSound. To get the timing right, so that it played rythmically, for each locomotion animation I found the frame where the first footstep landed and checked the percentage value at that point.
I then added 50% to that to get the location of the next footstep.
Setting up it up this way rather than trying to line it up with when I thought the character's foot hit the ground in the animation produced a more consistent sounding result.
Next, in order to play the sound randomly, I simply switched on a random int within AN_FootstepSound, playing 5 different footstep sounds I had.
Lastly, so that I could vary the volume with each step, I created a variable in AN_FootstepSound and toggled Instance Editable, plugging it into the volume multiplier paremeter of the SpawnSoundAtLocation calls.
This way I was able to edit the volume of the steps per-instance of AN_Footstep sound.
This proved quite useful for times like when, during the end of an attack animation, the character adjusted their stance lightly. In that instance I was able to quite easily decrease the volume for those smaller steps.
Here is how it turned out:
Author: Reilly da Silva