How To Create A Dynamic Footstep System In Unreal Engine (Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to another Unreal Engine 5 tutorial so in today's video what we're going to be going over is how to create a dynamic footstep sound effect system so if I hit play I'll show you what we're going to make today so you see we have three different surfaces in front of us here we've got concrete wood and gravel and when I walk over these surfaces we'll have different footstep sound effects so let's go over wood first you can hear it sound something like this and if we go over the concrete it's going to change and sound something like this go back over the wood and with the gravel they're all going to sound different now obviously the materials don't look amazing the sound effects might not be the best either but I'm just showing the functionality of this as well I'm using completely free Assets in fact the materials come default with unreal so this is just the functionality of how to set this up and it also sounds better if you include more sound effects to have more variety for example gravel you can hear we've got a few more than we do with the wood and the concrete so again there's many different ways to improve this but we're going over the function today so this be going over and creating so without further Ado let me delete this code and I'll show you how I've done it so the first thing we're going to want to do is make sure that we've got our footstep sound effects imported into our project so as you can see here I've got some for concrete dirt and wood the dirt I'm using for gravel once you've got these in here you can let me delete these first actually sorry so once You' got these in here select all of the ones for concrete for example so I've got four I'm going to select them all right click and create single Q and that is now my Q which will randomly play one of these concrete sound effects whenever this Q is called and we're going to do that for all of them so we've got that for concrete and then we'll do the same for our dirt or gravel and then the same for our wood as well and do this for all of the different surfaces that you have so the different footsteps that you've got here once that's done we're going to go to edit project settings and we're going to search for physical surface and this is where we can actually set up all the different surface types within our game so what you want to do is just go to surface type one for example or the next one that you have where it says None you want to select that and then give it a name so for example wood go down to the next one and do concrete and then the next one and do gravel and do this for all of the different surfaces that you want in your game you can come back later and add more you can remove them by just typ none so if you select it and put in none that will remove it and again just do this for all of the different surfaces you have so essentially all of these different footstep sound effects that we have here for me I just have these three so that's going to be fine and I'll close that like so then what we want to do is in our content browser we want to right click go to physics we want to create a physical material we'll Select Physical material here and then we'll name this one PM for physical material underscore and then one of the names you just added in the surface types in the project settings so for example wood we'll open this up then under physical properties at the bottom you've got surface type change it from default to one of the ones you made so you can see these are all the ones we just created I'm going to set this one to wood as this is PM wood we'll save that and close it and then we can select it and hit control D to duplicate it change the name from PM wood to PM concrete for example open this up and change it to concrete simple as that and then we'll do this again for all of the different surface types that you have once again so I have three wood concrete and gravel and again those are the ones which I made in my world settings because those are the sound effects that I have once you've done that for all of the different physical materials and surfaces that you have that means we've now linked a physical material to the physical surface so now we need to link this to an actual material that we have in our game so what we can do is find the material you want so for example I'm using this wood I'm going to open up the material and then you see on the left we have physics material slot here in here we're going to change this to pmore cuz that's the naming convention we've used and I'm going to do wood and we'll apply that so now this material here of wood let me close this this material here of wood is linked to our physics material of wood which is linked to our surface type of wood in the project settings as well so they're all linked together so this so now the engine knows this is actually wood we'll do the same here and it'll know that this is actually gravel and we'll do the same here and it'll know this is actually concrete so the player knows it obviously but now the engine knows it as well so once again open up the material change the physics material to pmore whatever it is for you so for me this one is gravel we'll apply it close it and it's a simp as that I'll do this one more time for my concrete and once again for you do this with all of the different surface types that you have in your game so now that I've done all of that we've now got these materials as actual physical materials and surfaces within our game so now how do we translate that to footsteps well that is actually also very very easy what we're going to do is go back into our content browser and we want to open up our player animations so for me that's just going to be character mannequins animations and then Quinn for me so the only animation I'm really using is run so I'm going to open this one up and show you how to do it in here what we're going to do is we want to go to notifies and add notify track if you've already got one then just go in there but I'm going to create a new one and then what we want to do in here is move along the timeline until you see the animation of a foot hit the floor so that's already on the floor there so we're not going to do it so we're going to look at the right foot here so that's going along we'll move the timeline over you can see it hits the floor around about here obviously in u5 we've already got these default ones here I'm just making them fresh so once you're in the location of where the footstep hits the floor that's where you want the sound effect to play we're going to right click on the notify track add notify we'll get a new notify naming this footstep now if you want to you can do footstep left footstep right but for me I'm just doing a general footstep and you Roll Along the Tim and again until the next foot step hits the ground which is around about here for me right click add notify now you don't need to go to new notify you should just see it here footstep like so and then again go along until the next one hits the floor which is here right click add notify footstep and do this for all of the different times that the feet hit the floor or where you want the footstep sound effect to play it is as simple as this and you're going to want to do this for all of your animations as well so again for me I'm just going to be doing it in the run but you can do this in run walk idle if the feet are moving in there you'll probably want to do this on jump land as well so again all of the different animations you are using within your game just do this process here once you've done that we want to open up our animation blueprint so for me that is going to be ABP Manny in here you want to go to the event graph and then we're going to right click and search for anim notify and then whatever you named it so I named mine footstep and now you see we have event anim notify footstep so now every single time that that notify is triggered in the animation or in any animation this event is going to fire off so this is where we're now playing the footstep sound effect now what we could do is just play sound out location or play sound 2D but that's not going to dynamically change based upon the surface we're on so we need to actually get the surface type of the material so to do that we can drag out of the event and get a line Trace by Channel like so for the start and end we're going to right click and try get porn owner out of this we're going to get actor location and that is going to be the start now for the end we just want to go straight down so that's very easy we can just drag out of the get act location get a subtract and then subtract one 100 from The Zed and that goes into end and so now we're just taking a line Trace from the player straight to the floor so we can see what the surface is of the floor that they're currently on and currently above we're going to hold down B left click to get a branch with a return value going into there so it only tries to play a sound effect if it actually hits the floor out hit we're going to get surface type and it is as simple as that to just get the surface type linked to the physical materials that we created earlier out of ouit I'm also going to break hit result and open up just so we get access to location so I know where I want to play my sound effect then out of get surface type the return value we're going to get a switch on E physical surface which is now going to open up all of our different physical surfaces that we've got here and what I'm going to do as well is go to edit project settings you don't need to do this I'm just showing you it for future expansion if we go back to our physical surface let's say you add another one so let's say I've now added in snow as well if I close this you can see it's not on our switch here so what you can do to then have this be updated here is just simply right click on it and refresh nodes and now we have snow there as well so that's how you can then keep on expanding this system for when you get new materials into your game so what I'm going to do is right click play sound at location and then I'm going to right click on sound promote this to a variable and name this footstep sound effect and drag that just above it here then I'm going to hold down left alt and drag in to set it and I'm going to connect this into all of my different executables off of my switch so we've got wood concrete and gravel I'm not going to do default because that basically means if it's not any of these it's going to play one which you might want to do I don't and I'm not going to do snow cuz again I've not set that up set that up I just did it to show you for future expansion so you want to set all of these here and then drag and then these can all Connect into that one play sound at location node there just to make it nice and efficient and the location is going to be location from the break hit result then in these set footstep sound effects we can just add in the sound effect we want to play so for wood we want to do our wood one Q concrete is going to be concrete q and then grav is going to be I think mine's called dirt isn't it yeah dirt que like so we'll compile and save and that is now it completely done and working perfectly for us it is very very easy and simple to do so again if I'm walking on here nothing happens but this is what default would be because I haven't set up a surface here so again if you want that go ahead and add it in if I walk on here we are playing concrete and if I were to come off of it again no more is playing we're above concrete now now we are above wood and you can hear it playing and now we are above concrete so you can hear that the footstep system is dynamically changing depending upon which surface we are currently working on which is a fantastic little feature to add into your games it's that extra little bit of detail which really excels your game to the next level so I think that'll be it for this video as we've done everything we've want to do what we've done is we've set up a dynamic footstep system which will change the sound effect that is playing based upon the surface type which you're currently working on so again in this example I've got concrete wood and also gravel and again you can expand this as much as you want so thank you so much for watching this video I hope you enjoyed it and I hope you found it helpful and if you did please do make sure to like And subscribe down below and I'll see you all in the next [Music] one oh
Info
Channel: Matt Aspland
Views: 3,760
Rating: undefined out of 5
Keywords: ue4, unreal engine 4, unreal engine, tutorial, ue4 tutorial, unreal engine 4 tutorial, how to make a game, how to, blender, unity, games design, ue5, unreal engine 5, unreal engine 5 tutorial, ue5 tutorial, footstep, sfx, dynamic
Id: KUhOUkLCfgc
Channel Id: undefined
Length: 12min 30sec (750 seconds)
Published: Sat Mar 30 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.