Advanced Footstep System™

Getting context-correct footstep sounds will never have been so easy.

It is AVAILABLE! Go GET IT NOW!
NOTE: Unity 5.0.0 has a bug in PlayOneShot. If you are not hearing sounds in the sample scene when you move around, please update to Unity 5.0.1 or later.

Experience it games like Playing Mondo, Valiance Online and Project Gorgon!
NEW: YouTube of Valiance Online Demo!
Note: There is a known-issue with 3rd-person jumping, being worked on as we speak. Largely a bug in Unity’s CharacterController, but stay tuned, a fix is on the way!

Setup: import your various footstep sounds – walking, running, etc., as many different ones as you like, for each type of material you can step on. Don’t have any? Get some from Indie Game Models.
Drop the AFSCharacterFeet prefab onto your player, assign textures and sounds to each category. Pretty much all drag-n-drop. You can specify the stride which changes from walking to running etc. Some other features too. If you have a rigged character (animated, Mechanim, Locomotion, etc.), you can instead use an AFSSingleFoot prefab on each foot.

Anyway, that’s all there is to it. Watch these demos. Note how you can stay on the path, walk the plank etc. The white square is ‘undefined’ or ‘default’ which ever you prefer. Idea being, you can assign ‘default’ sounds to where textures are undefined. Useful as a ‘catch-all’ or ‘this thing needs sounds’ indicator. I’ve set it to the latter so it ‘beeps’ but it could just as well be generic footstep sounds.

1st Person:

3rd Person:

INSTRUCTIONS
With this package, you will instantly be able to add a variety of footstep sounds to anything, and with no coding, it will choose the sound based on the speed of movement and the texture that the object is moving over (including jumping and landing).

Thus if you are walking on pavement, it will sound like that. If you then walk onto a wooden plank, it will sound like that, and so forth.

(Note: only a small sampling of footstep sounds are provided. You may record your own or download them from whatever sound effect library you like. There are many on the Unity Asset Store. Don’t have any? Get some from Indie Game Models.

Features:

  • Beyond what the v4.3 CharacterController provides
  • Works with 1st person, 3rd person, animated, Mechanim, networked characters.
  • Works with anything that moves (player or not, bipedal or not)
  • Define strides like walk, run and more
  • Jumping and landing supported
  • Works with any number of textures, any number of terrains
  • Default sounds to fill ‘undefined’ areas
  • Works with Unity 3.5 and 4.x
  • Several sound samples included:
    * Grass, Wood, Dirt, Gravel
  • Supports any number of audio sources for richer experience
  • Source code included

Usage:

Setting up a 1st Person Controller:

There is a prefab called AFSCharacterFeet which has one stride group and default sounds defined for it already. You can simply drop this onto your character and it’s good to go. This is equivalent to the Character Controller provided in Unity 4.3. But, you can then add to it as you like.
Note: jump and land sounds only work if there is a CharacterController on your character, but other movement sounds can work on anything that moves.

Next, you will define how many different speeds of movement you want to provide sound for, let’s call these ‘strides’. If you will only be walking or running, this will be one. If walking and running, two. You may also want trot, gallop, cantor, skip, jog, or whatever.

So click on Map Stride to Texture Groups and enter 1 (or whatever). This will provide you the structure for defining a stride.
In the Name field, enter the name of this stride (for example, walking). This is only for your benefit to help you know what this is.

Enter the stride length (the distance a between two successive footsteps). In a normal adult human this will be about .75 to 1 (meters). If running, this may be more like 1.5 to 2. Also enter the maximum velocity (in meters/second) which this stride covers. Typically speeds for walking are around 1. Entering 1 here means that any movement up to 1 m/s will be considered ‘walking’. If you have walking and running, then your running velocity might be 6, meaning velocities greater than walking but less than 6 m/s will be considered running, and so forth.

TIP: It may be more convenient to enter 1 for the size of ‘Map Stride to Texture Groups’, fill out that first structure, then increase that number later to add jogging, running, etc., as that will make a copy of the first set, saving you some time.

Now click on Texture Groups. This is where we will tie footstep sounds to textures. Set the size to however many textures you will be supporting. If you have 15 textures that can be stepped on, enter 15. In the demo we have 5.

Now open the first element (Element 0). Note there are fields for Name, Textures and Move, Jump, and Land audio clips. For your own convenience, enter a name for this group. In the example ‘wood’. Drag your texture onto the Textures field to add it to the list. Note that typically you will only have one, but you can drag more there if you like. Example: You may have several ‘wood’ textures that will all result in the same sounds. In that case, just drag all the wood textures onto the Textures field. In the demo, there is one ‘wood’ texture.

Now click on Move clips. Drag the audio clips from the Project window onto the Move Clips field. You may have a few.
WAIT! Why? You can have just 1 clip that sounds like a footstep on wood, but it is the same one that will play for every footstep, which sounds very artificial, so TIP: Have at least 2, but better 3 or more clips of that motion on that surface. Drag the clips from the Project view onto the Move Clips field. Advanced Footstep System™ will pick a random clip from this group to play as the object moves.

If you plan to jump and land, and have sounds for those on this texture (jumping from wood,landing on wood in the demo), then drag those clip(s) onto the Jump Clips and Landing Clips fields. Note that jumping and landing are typically not as common so you might get away with one of each for these.

Repeat for all the textures you have for this stride.

Repeat the above for each type of stride you will support.

Now, you may not have enough sounds for every texture you can walk on. No worry, you can use the Default Clips for this. It’s the same as any Texture Group, in that you may have multiple clips for moving, jumping, and landing. These will play when the object is moving over a texture which you have not set up in Advanced Footstep System™ explicitly. If you intend to use sounds for every texture, you may want to use a distinct sound (a beep in the demo) as a sort of debugging tool, to alert you to missing texture-to-sound mappings.

OTHER SETTINGS:
Choice Type
When walking over Terrains, there are areas where the textures are blended. Which sound will play? Well you can chose how this is determined with the ‘Choice Type’ field. ‘Predominant’ means it will pick sounds associated with the most predominant texture at this spot. ‘Probable’ means it will pick from all textures at this spot, a random texture (and its sounds), weighted by the visibility at this spot. Thus if there is 90% grass and 10% gravel, those are the chances that those textures will be chosen, and hence sounds played for them.

Max Check Length
Max Check Length is useful when the player is not, or not quite, grounded. Thus if he is flying or falling from a great height, or on the edge of a bridge or whatever, it will look only as far as this length (from the origin of the object which AdvFootstepSystem.cs is placed) to find ‘the ground’. If the distance is too far, no sound will be played. Otherwise you would hear footsteps even when soaring over the scene. Note that for characters of larger or smaller size, you should adjust this accordingly.

Min Velocity
When your character is not moving, or nearly not moving, you may want no sound. Use this to set that minimum velocity where no sound would play. This can provide ‘stealth’.

Single Foot
The default is unchecked, use this for an ‘overall character’ which has one set of sounds for the whole thing (generally this is a 1st person character). But if you want to have each foot of a character produce its own sounds, check this box, and place one of these components on each foot in your rig (there is an AFSSingleFoot prefab to help you here). For this you probably want a fairly short ‘Max Check Length’ as the control will already be close to the ground. Also, ‘Stride Length’ will be ignored, as it now triggers when a foot hits the ground, rather than by how far it has moved.

NonConsecutive
By default, the sound for any given footstep is determined randomly from the set of clips you supplied. This means that sometimes you might hear the same clip twice or more in a row, for example:
0 2 2 1 0 1 1 2
If you set NonConsecutive, it will guarantee that no two clips will play consectively, example:
0 2 1 2 0 2 1 0 1 2.
Note that if you have one or no clips, this doesn’t matter. If you have two clips, it ensures they will
alternate, for example:
1 0 1 0 1 0 1 0 1 0

Volume Variance
By default (zero), each footstep plays at the same volume as the last. If you would like to mix that up a bit, change this number from 0 to as high as 1. It will randomly pick an value to add or subtract from the default volume. The default volume is whatever the first AudioSource’s volume that you have in objects below this component.

Faster Is Louder
By default, the volume is pretty much the same no matter what speed the character is moving (and Volume Variance averages out to the same volume). If you would like the volume to increase with the speed of the character, check this box. Volume will scale from the volume set on the first AudioSource it finds under this component, to 1, when moving at full speed. Full speed will be anything from the highest velocity you have defined on up.

Initial Silence
This is the number of seconds to wait before making any sound. If this is zero, chances are all your characters feet will be heard at startup because they just ‘hit the ground’. So this delay allows for them to ‘settle in’. You may have some characters that spawn in air and land, so make this delay just a bit less than the time it takes them to hit the ground.

TIP: You don’t have to use all the same kinds of sounds for the same group. For example, in the demo we have a texture called ‘Grass&Rock’. So naturally, you should sometimes hear grass and sometimes rock, and sometimes clips that actually have both grass and rock in them. So you can mix the clips in the Move Clips group. In the demo we have two ‘grass’ clips and two ‘gravel’ clips. As you walk on ‘Grass&Rock’, you will sometimes hear grass and sometimes hear gravel.

NOTE: The child of the AFSCharacterFeet prefab is an object called ‘FootSounds’ containing an audio source. This is where the sound will come from. By default it is placed at foot level on a standard 1st Person controller. You may want to move this to match where the feet of your character actually are.

AND TIP: You can have any number of ‘FootSound’ objects. Just select and Ctrl-D to duplicate. You can, if you like, move them around, accounting for where feet might be. You might just have 2 for left and right, or 4 for some 4-legged creature, or 100 for a centipede. They are chosen in round-robin fashion, and as available. So TIP: If your footstep clips are long (because they contain reverb, echo, etc.) and are not playing all the way through, you can account for this by adding more ‘FootSound’ objects, as then Advanced Footstep System™ can start playing the next footstep even though the one before it is still playing.

Setting up 3rd Person or other characters (where you see the feet)

This uses the same script, but there is another prefab, AFSSingleFoot, with the settings adjusted for a single foot.

Add this prefab to each foot of the character rig that you want to emit sounds. It’s probably a good idea to make sure that it has a 0,0,0 offset from the foot. Note that ‘Single Foot’ is checked, and the ‘Max Check Length’ is much smaller. This is because it’s only going to check that a foot has hit the ground (not that the entire character has hit the ground, as in the 1st Person case). The ‘Stride Length’ is ignored in this case. The stride group (walk, run, etc.) is chosen per-foot, as it should be.

Follow the instructions for adding strides, textures, and sounds as in the 1st Person case.

And that’s it! If all your feet make the same sounds, just duplicate the first one you made, drag that duplicate to the corresponding part of the rig where the other foot is (feet are), and that’s it! Even if there are a few differences, you save time by making a duplicate and re-using it anyway.

TIP: If you have a ‘limp’ or other feature whereby the sound of one foot would be different from the other, simply use the different sound clips for the other foot.

14 thoughts on “Advanced Footstep System™

  1. more bug !!!!
    NullReferenceException
    AdvFootstepSystem.CheckFoot (.FootStepSoundController& footSoundController, Int32 zDir) (at Assets/AdvancedFootstepSystem/Scripts/AdvFootstepSystem.cs:250)
    AdvFootstepSystem.Update () (at Assets/AdvancedFootstepSystem/Scripts/AdvFootstepSystem.cs:152)
    grrrrrr !
    I lost all my input lines (about 3 hours works !!!!)
    I had 5 different surfaces with 12 material and 3 sounds for each.

    • Stigma,
      First, thanks for trying Advanced Footstep System. Sorry you are having problems with it, and I’ll do everything I can to get you going. I’m looking at that line in the script, and it’s odd that it would get that far. For this type of thing to happen, you would either have to have 1) no stride groups defined, or 2) no texture groups defined, or 3) no textures in the group. Make sure you have at least one stride group, at least one texture group, and and at least one texture in the group. The code should be preventing this error, for sure, so I will fix that ASAP (it’s going in with a few other fixes and enhancements) I hope to have that approved in the store within a week.
      If you feel up to it, would you mind recreating at least a little of what you were doing and take a screen shot of it?
      Did it crash out in the editor or when running?
      How did you lose the work, had you saved the scene?
      Any information greatly appreciated.
      Dave

    • Riccardo, which version of Unity are you using? I’d like to know more about how you set things up too, so I can get a fix out ASAP. Thanks.

  2. hi !!
    few days ago i bought this from asset store but it is not working on my unity5 (compiler errors), can u help me on this? will be any update soon? if not ¿can u refound my purchase?

    thanx !!!

    regards

    leonardo chavarria

    • Hi Leonardo,
      Thanks for the purchase and letting me know of this! I’m having trouble reproducing the compiler errors.
      If possible, could you send me a copy of the errors you are seeing, either a screenshot or copy/paste from console?
      Which version of Unity are you using? There is a problem with 5.0.0, but it’s fixed with 5.0.1

      • Dear friends,

        Thanxs for ur support, i update my unity to version 5.0.1 and now the script is working perfectly fine.

        great job!

        kind regards,

        Leonardo Chavarría

        • hey people,
          i get this error from console:

          IndexOutOfRangeException: Array index is out of range.
          AdvFootstepSystem.CheckFoot (.FootStepSoundController& footSoundController, Int32 zDir) (at Assets/AdvancedFootstepSystem/Scripts/AdvFootstepSystem.cs:185)
          AdvFootstepSystem.Update () (at Assets/AdvancedFootstepSystem/Scripts/AdvFootstepSystem.cs:152)

          whats wrong?

  3. Hi
    I have AFS working good with Unity 5. But it will not work with ProBuilder…I cannot get AFS to recognize different textures in Probuilder built environments. Any ideas why?

    • Hi Andy,
      Thanks for trying AFS. I have not used ProBuilder myself, so I’m not sure at this moment what is happening with it. I will contact ProCore and see if we can come up with a solution for you.

    • Hi again. Solved. Hope this helps someone..you need to “Detach” the floor surfaces in ProBuider as ‘New Object’ and all will work as expected.

      • Andy, thanks for sticking with it and finding the solution, and for sharing it here in case others run into it. I’ll also make note in the next release’s documents. Thanks again!

Leave a Reply

Your email address will not be published. Required fields are marked *

Human? *