Dynamic Footstep System | Different Sounds On Different Surfaces - Unreal Engine 4 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys welcome back to another managing 4 tutorial today i'm going to show you how to create a dynamic footstep system so that when you walk on different materials it plays different sound effects so the examples i'm going to be giving you today are grass concrete and wood and i'm going to be using some sound effects which i got off freesound.org which i'll link in the description down below so you can obviously use this with any material you like any sound effects you like and you can have as many as you like but these are the examples i'm going to be doing today so without further ado let's get right into it the first step you're going to want to take is obviously adding your audio so i've already imported all of my audios here again you're going to want to make sure that these are a wav 16 bit file otherwise they won't import correctly so i have two concrete two grass and two wood you can have as many as you like one two three anything like that for this example i'm doing anyway so i'll show you what these ones sound like now the grass footsteps i've noticed sound a lot like minecraft however i'm not sure if they are from minecraft or if they are genuinely grass footsteps they just sound extremely similar but like i say i've got all of these off of freesound.org and also while i remember i do need to credit some of these so the wood are by ronald van wondering on free sound the concrete is by moving played on free sound and the grass is by snowman on free sound and the reason i'm saying that is because they have these under the attribution license meaning you have to obviously give them credit when you use these so if you use the sound effects in your game make sure you put their names in the credits and obviously link it back to free sound so like i say these sounds are linked in the description down below so once you've imported your sounds what we're going to do is create a sound cue for each of these so what we're going to do is hit right click go to sounds and then we're going to create a sound queue there this one i'm going to call concrete footstep queue and now you can call this way if you want but this is what i want to do it because that makes the most sense for me and then we're going to just duplicate these another two times so ctrl c ctrl v this one i'm going to change to grass footstep q and the last one to wood so you can see i'm naming these for the sound effects i have so get the correct amount of sound hues that you need for you so i have concrete grass and wood if you have more than that or less than that and get the correct amount and so we can do is just open these all up straight away so select them hit enter to open them up like that and we're going to import our sound effects so we'll start with wood first we just made that bit smaller like that select our wood sound effects just drag and drop them in there we maximize this again you see we now have these here so you can select the audio mess about with these if you want make the volume louder quieter all of this good stuff what i'm going to do is simply just come out the output okay random put both of those in there so the random goes into those the output i'm going to get a modulator i'm going to put the output of that into the output of the actual sound cue and so what this is doing is it means that whenever this sound queue is called it's going to play a random sound effect and this is good because then it won't just play this same exact sound effect every time so it doesn't sound like a looping sound when you're walking on wood or grass or anything it will sound different and have more texture kind of to it so just sound a lot better so we can save that close that one we'll do the same for grass so select grass put that in there actually we could have copy and pasted that so we'll do is get a random put that into both of those again output into a modulator put that in there and if you have more than two sound effects for your random what you can do is just hit the plus input there or add input sorry hit the plus and then you get another node in which you can add another sound in there but i'm just going to right click delete the input as i don't need it so i'm going to do is select the random and the modulator control c to copy those we'll save this we can close it do it again for the final concrete one open that up there put those in move these down and hit control v to paste in the random and the modulator nodes there and we'll plug that in like so and again save and close this so now this is the sound cues done and now what we want to do is create physics asset or physics material for these and what this does is this is going to create the different physics for the wood the concrete and the grass so that the game and the player knows what it's walking on so it knows what sound effect to play so to do that we're going to go to edit go down to project settings here and then we're going to find the physics tab down here there it is under engine if we scroll down we should find physical surface here and so this is obviously where we put in the physical surfaces we have in our game so surface one which is going to simply click on and change this name to grass or whatever you want to call it change this one to wood and this one to concrete obviously you put these according to what you want them to be make sure that the spelling and capitalization is memorized as that needs to be the exact same name we do later on so again change this to grass wood and concrete whatever you have and as you can see we have 62 different surfaces we can add here so that's how many different physical surfaces you can have in your game and so obviously as many different sound effects you can have on walking over different surfaces so that's all good so what we're going to do is just close that now we're actually going to make those physical materials so what we've done is made it so there's the physical surface now we'll make the material to go along with that so to do that we're going to right click go to physics down here and then physical material here i'm just going to select physical material there so select i'll start with word so i'm going to call this one word underscore footstep underscore pm for physics material and like we did the sound queues we'll duplicate these twice so ctrl c ctrl v ctrl v and then i'll rename these ones accordingly as well so obviously i'll leave footstep pm there i'll just change it from wood to grass and then the same with this final one here it will be concrete underscore footstep underscore pm and again make sure that these are good according to you so i've got the concrete grass and wood there and again we'll just open these up straight away so control to select them all and hit enter to open although that's open them all at the same time to actually we'll open them individually like this surface type will set this one to concrete so this is where you're then setting it so obviously we just went and created the surface in the settings this is now where it's going to be so we've got the concrete open we set the surface type to concrete down here under physical properties meaning that this physics material will be determined and activated for concrete so we'll save close that open up the grass one that is then grass there save close and wood so it's a very repetitive thing you know what you're doing you just change it personalized for each one so again would save and close that now what we're going to do is actually set this physics material onto the material that we wanted to play on so obviously here i have the grass the concrete and the wood materials that i want to be using in my game so you'd find the materials you want to use and open them up so i've usually started content ones so i'm just going to find those here we have ground grass if i open up that material there we're going to do is simply just have it selected like this and under physics material here we're gonna simply select the one we want so this is for the grass material so i'll put grass footstep pm like that if i hit apply this should now work so this material here for grass now also has the physics material of grass as well meaning that this will play the correct footstep we'll apply save that close it and do that for all of the other materials that we want so again do this for all of the ones that you have i'm also just going to do this for concrete as well concrete tiles open that up physics material is concrete footstep pm i'll apply and save this and i'll do it again for wood as well so we go supplied save that close it and finally i'll get the wood wood floor walnut polished physics material wood footstep pm and i'll apply and save this there we go once that's done we can close these again like so i'm just going to go back to this folder just to get more organized and actually what we're going to do is open up our animation so we don't want to go to this folder we're going to go back to content and find our animations so you're going to be opening up the animations that you're using so as i'm using the starter mannequin i'm going to go to mannequin animations and here i have them so the examples i'm going to be showing you are the run animation and the jumping animation as those are the ones the character is using by default for me obviously you'll put this on all of your animations that you want it to apply to the exact same process which i will show you just make sure that you do these only on the animations you want so i've got third person run and third pass and jump open those up like so if i go to run there we can see that this is the animation we have if i just hit pause there what we're going to do is find the frame where the foot is on the ground so where you want to play a footstep sound effect so i've nearly got it there just by randomly pausing it so if you go to the start move this along and that is where the foot is on the floor i think around six two eight six seven or eight i think seven is where it's directly on the floor there so when you find that frame what you want to do is go to this notifies track up here i'm gonna right click on it so notifies one right click add notify and then go to new notify there and call this whatever you want i'm just going to call this footstep notify like so and then actually that didn't go where i thought so move it all the way over to the correct frame like so and what this does is essentially it means when the animation is at this frame it will play this notify meaning whatever you have set off of this it will do so there's probably i think there's another footstep in this animation as well yep over here it's at 15 so if we just get another notify so again what we'll do is right click on this track where i want it to be add notify now we can get skeleton notifies and get the footstep notified which we created earlier so now we have those in there like so meaning that when this plays footstep goes down there notifies footstep goes down there and it notifies so we've got that for the run animation we can simply save and close that and that will do the jump animation as well obviously again do this for all of the ones that you want it on so for me i just want it when he lands which is around here i'd say frame two like that so again right click add notify skeleton notifies footstep notify it like so and i believe that's the only one here yes it is so now save and close that as well again do that for all of the ones you want it on and so now what we can do is go to the animation blueprint so again i'm using the third part of mannequin so for me that's third person and in bp so just make sure that you open that up and then go straight over to the event graph here and what we're doing here is actually getting that event we just made which was the notify so like i say when the frame of the animation goes over that it will send a notify so basically a notification to the animation blueprint which is an event which we're going to call now so it can fire off that line of code so what this is we'll find some space down here we're going to right click and we're going to get add another try event there so open that one up event and mode fight footsteps notify so that is basically the name of the notify that you made which is this one for me so we just get that in there like so it's like i said when the animation's playing when it reaches this notify it will fire off this event meaning we'll fire off the code we're about to create here so what we're going to do is come out of this and get a line trace by channel so line trace by channel there and what this is going to be doing is seeing which floor or which surface sorry the player is standing on so we're going to put a line trace from the player here going straight down to the floor to see what surface it is on so grass would concrete etc anything along those lines and then it will play the according or the correct sorry uh sound effect for that so what we're going to do to figure this out is we'll move this over a bit actually we'll right click down here and we'll get player character so obviously getting the character we're playing as at the return value we'll get actor location so obviously we want to be able to get the location the player is in to see which surface he's on and so this will be the start as we were seeing where the player is that's where the line trace will start so it starts from the player and for the end so where we want the line trace to end is the floor and now for the default mannequin we're going to be minusing 150 to be able to get to the floor as that's the distance from the character to the floor obviously though if you have a different character or sorry a drastically different character so if you change the mesh quite a lot this might be different for you but obviously it depends on how big your mesh is and how big your character is all of that but if you've changed it and it's still very similar to this default mannequin here which it most likely is this value should still be fine but if it doesn't work just mess about with that so what we're going to do is come up the return value of the getax location i'm going to get a vector minus a vector like so plug this into the end as again this is where the line trace will end and we're going to minus 150 on the z so just put 150 in the z like so so again this is find out which surface we are on so after that we're going to come out with the line trace by channel here so actually we'll come out without hit we'll break hit result expand that down there like that so we get more options as we want to use the location as obviously it's the location the player is in and also out of how out hit as well we are also going to get the surface type as obviously we want to be finding out the surface type we are on so then out of the c line the execution node of the line trace what we can do is get a branch like so pull it out there and then off the get surface type what we can do is drag out of this and switch on the physical surface like so and what this is doing is obviously as you can see it's getting the different surfaces that we have so we've got the grass the wood and the concrete surface now the default will be what you're not going on so you can put a normal sound effect on there if you want but for this example i'm just going to be showing you the different ones we've created and so this is going to be going into the true of the branch there so you go off of true into there and sorry the condition for this branch wants to be the return value off of the line trace here then obviously once we've figured out which surface we are on which is what this is doing we want to play the correct sound effect so if we're on grass first we'll do that example it says at the top we're going to drag out of that and play sound at location like so the sound asset will also be the one we want which will be grass footstep q make sure it's the cue as that has the different ones in that we created the location is just going to be the location of this break hit result here again to get location plug that in there like so and then it's just the exact same for the wood and concrete but you'll see you change the sound so we can duplicate this another two times and plug these in accordingly so obviously plug the second one into wood change the asset to wood footstep cue put this one into concrete change it to concrete footstep queue like that and the location will be the same location out of the brake hit result like so so now this should be all done i'll run you this again what's doing is when the animation goes over the notify that we've created it's going to be getting the player location to start the line trace and then it will be minusing 150 meaning it will be going down to the floor to end the line trace and then once it's done that well it's going to use that line trace for is to get the surface tight and if it does hit the floor sorry it will get the surface type and then play the according sound effect which it needs depending on where you are walking so if we compile and save this we minimize if we hit play to test it see we're walking around we don't hear anything if we walk on the wood we get the wood walking sound effect if we walk on the concrete it changes to the concrete walking sound effect and if we walk on the grass it changes to the grass walking sound effect so this works perfectly we've got grass here concrete here and wood here so that works out perfectly so i think that'll be it for this video so we've done everything we wanted to do we've set it up so that we have our different sound effects here for the different floor types that we have we've set it up in the animations so that it gives us a notify when we have a footstep play and we've also set up so we've got the line trace to play the correct sound effect and it sounds something like this so i think number for this video so thanks so much for watching i hope you enjoyed i hope you found it helpful and if you did make sure to like subscribe down below so thanks so much for watching and i'll see in the next one [Music] you
Info
Channel: Matt Aspland
Views: 57,047
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, 3d modelling, blender, unity, games design, graphic designer, ue5, unreal engine 5, sfx, sound, sounds, effect, effects, foot, step, steps, footstep, footsteps, dynamic, different, surfaces, materials, material, surface, grass, floor, ground, play, at, on, location, affect, affects, system, different sounds, different surfaces, ue4 footstep system, wood, concrete, horror, easy, quick, simple, basic, for
Id: 1TTey8wUUvU
Channel Id: undefined
Length: 16min 13sec (973 seconds)
Published: Wed Sep 23 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.