Footsteps by itsmars


(Marshall Heffernan) #1

Footsteps by itsmars


FootstepMaster_Events.cs (21.3 KB)
FootstepMaster_Curves.cs (22.4 KB)


Setting up the Inspector

Choose a Volume, Volume Variance & Pitch Variance.
Drop your player’s foot bones (from your HIPS/BIP/RIG/MESH) into the above fields.
Insert sounds into the Array(s).
If you’d like to use a particle system when your foot touches the ground, choose Instantiated or Toggled.


-Tag your Terrain with “Terrain”.
-Tag non-Terrain floors with the appropriate tag (a stone bridge would be “Surface_Stone”, etc)

-Ensure your Terrain Textures have the Array Type somewhere in their filename.
(for a grass sound, make sure the word “grass”, “Grass”, or “GRASS” is somewhere in the filename.)


If you want to use Animation Events, use the “FootstepMaster_Events” script.
If you have a large blend tree, then use the “FootstepMaster_Curves” script.

Watch the video above to see how that is set up.


Show some love :heart:


Character controller demo
Stomp audio when enemy walks
(Jay Bacal) #2

Hi Marshall,

Your footsteps script looks very useful!! Thank you for this. The video is also very informative.

Could you say where you got your footstep sound effects for the different ground materials? Also where did you get your footstep particle effects?

Thanks,
Jay


(Marshall Heffernan) #3

OpenGameArt has…
Grass/Sand/Stone
Wood/Stone/Leaves/Gravel/Mud
Stone/Water/Snow/Wood/Dirt
Snow/Gravel

Visionary Sound has…
Carpet/Metal/Foliage/Gravel/Wood/Aluminum/Stone

I use Kalamona’s “Shuriken Magic” Effect Pack as a base and then tweak the prefabs to make my own particle systems.


(Jay Bacal) #4

Thanks for links. I didn’t realize that OpenGameArt had sound effects too. Nice to know.

Did you make your own particle effect system for your water splashes also?

Thanks again,
Jay


(Alien) #5

very nice. Thanks!


(Marshall Heffernan) #6

My snow and dirt FX look great, but the water FX looks pretty bad.

If you’re interested in learning more about Particle Systems, you should check out Tyler Wissler on youtube. He’s pro.


(Jay Bacal) #7

So far your script is working like a charm!

Also thanks for the Particle System tutorials link. The tutorials look comprehensive.

Best,
Jay

REQUEST-- It would be helpful if the toggled FX could draw from a small of pool of effect instances (2-4 perhaps) so that the effects could have a bit more time to display before being reused. Currently, if the player is running, the effect cuts off too quickly because there is essentially only 1 effect in the pool.


(Florian) #8

Please commend his youtube channel and suport him for more videos !!!


(Leslie Young) #9

Very cool system and you do a really good job at explaining how to use it.


(Darren Fritts) #10

Excellent work @itsmars! Very useful and well done. Tagged with a “like”.

Not to go too far off topic, but can I ask where you got your character models (wizard & archer)?


(Florian) #11

It’s from https://www.mixamo.com/


(Marshall Heffernan) #12

@Helgard
The water footsteps, although I didn’t mention it in the video, have been improved.

All you have to do is select your Water GameObject and put it on the TAG of “Surface_Water”.

The raycast will shoot down from about 1.5 meters above your foot, and if the raycast hits a GameObject with the Tag of “Surface_Water” it will play a water sound.

Just give your Water GameObject a Box Collider, and check the “is trigger” box.

You no longer have to use a “water texture” or a box, with On Trigger Enter/Exit events. Too easy.


(Darren Fritts) #13

Ah, yes … thanks, @2-1be. I’d forgotten all about the Mixamo characters. I’ll have to dig those out and play with them again. You can’t have too many characters or great animations.


(Alien) #14

Hey i have an minor issue, was wondering if anyone experienced it. i have setup the footsteps sounds via the animation curve, everything seems to work fine, i have a number of textures setup and the footsteps Sfx change and the (instantiated) FX (dust, snow, water) work fine. the only issue i have is that when i stop walking, i get about 3 more footsteps sounds, even though the character has stopped.
anyone have any idea what might cause this?

Sample video: footsteps2.7z (1.1 MB)

couple of additional screenshots


(Marshall Heffernan) #15

Ooh, that is weird.

I make a quick change in the C# to require the “Forward” float, from your Animator Controller, to be greater than 0.

That should make it impossible for sounds to play, unless you’re moving.

Wanna give it a shot, and let me know if it works?

F̶o̶o̶t̶s̶t̶e̶p̶M̶a̶s̶t̶e̶r̶_̶C̶u̶r̶v̶e̶s̶.̶c̶s̶ (23.1 KB)


(Alien) #16

thanks ill try it tonight after work. thanks!


(Alien) #17

swapped the script, same issue.

i double checked and only have 1 audiolistener (just incase there was some weird reverb problem or something) but nope, not that either…


(Marshall Heffernan) #18

Does this happen without your particle prefabs?


(Alien) #19

yes, i unchecked the instantiate FX and it still does it.


(Marshall Heffernan) #20

Apologies on the late response.

I think the best course of action would be to add 1 line of code, a Debug.

If we do a debug saying “Footstep NOW” before we trigger the sound, then we can watch your console;

If we get the 3 extra debugs, we’ll know it’s a curve problem, and I can put in more preventative measures to ensure this doesn’t happen.

If we don’t get the extra debugs, then we will know something else is wrong - whether that be some kind of Unity reverb, audio listener, audio source, your sound effects, etc.

I can add in that one line of C# for you (or two - one for each foot) after work, if you’d like.