Foot step sounds for a Humanoid

One of the requests for Humanoid Control was to implement audio clips being played for every footstep such that you can hear yourself walking. With the new Foot Input functionality you can do this very easy, without programming!

TL;DR

Add the Audio Source to the Foot Target and call Play from the Foot Target Hit Ground event.

The Sounds

The first thing we need to do is adding the sound players or Audio Sources to each Foot Target. These components will play the sound.

The set the AudioClip parameter to the sound you want to use. I have a .wav file in my project called footstep.wav which I am going to use.

You may want to disable Play on Awake in the Audio Source to prevent foot step sounds when the scene starts.

Foot Input

To trigger playing of the sounds, we use the Foot Input which is provided by Humanoid Control. Add this component to each Foot Target, just like we did with the Audio Source.

You see the event Hit Ground. This is the event we are going to use to generate the sounds.

In the drop down we choose the entry Foot because we are going to call a function on this foot.

Then in the next drop down we can select AudioSource.Play. This will call the Play() function on the Audio Source component found on the Left Foot Target.

For the last parameter we keep the default value Start. This will make sure that the function Play is called when the foot starts to hit the ground.

Play

That’s it. Now hit Play and hear the sounds!

Leave a Reply