Dynamic Footstep System In First Person | No Mesh Or Animations - Unreal Engine 4 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to the region 4 tutorial in today's video i'm going to be going over a dynamic footstep system in first person so previously i went over just a normal footstep system for first person so if you don't have a mesh or animations this is going to work and i am actually going to be advancing upon that video to make this system here so if you haven't already seen that i'd recommend going watching it as we set up the base code for the footsteps and in this episode we should be determining which sound effect to play depending on the surface we are on so let me hit play and i'll show you what's going to sound like so we get in we can walk around here we just have a normal sound effect so this is just going to be our default one when we don't have a material designated we're going grass we're going to get a grasshound effect like this we go on wood we're going to get a wood sound effect and if we go on concrete we're going to get a concrete sound effect and you can set these up to be however you like as well completely customizable you can have different materials as many materials as you like i actually think the cap is about 50 but you can have quite a lot there's a lot of choice a lot of customization for this so let me delete this code and i'll show you how i've done this so the first step we want to take is we want to import and create our sound effects so actually let me delete the sound queues as well sorry so what we're going to do is import the sound effects we have so i've just got these ones off of freetown.org and are the same sound effects i used in my third person version of this for the dynamic system so i'm using concrete grass and wood now again you can use this one if you want you don't have to have two for each one you can have one three anything i just wanted to to give them a bit more variety once we've done that once we've imported them we're going to make sound cubes out of them so we're going to right click go to sounds create a sound cue i'm going to name this one concrete cube you can name this concrete footstep queue but this is going to work for me i'll minimize this a bit and drag in our concrete footsteps in here like so dragging them down out of one of them i'm just going to get a random node plugging the other one in there out of the output i'm going to get a modulator plugging that into the output of the sound key there so now when we play it we're going to get a random sound effect between them now it's a 50 50 chance i think we have two so it's most likely just going to go between the two like that however again the more you add the more random it's going to be we can save and close that and then we can just duplicate this so right click duplicate name it grass queue and i'll right click duplicate that and name it would cue now we're obviously gonna need to open these up and change the sound effects inside them so grass queue we'll take the concrete ones drag in grass plugging them in there accordingly like we did with the concrete so now we play this one it's gonna be grass and also i should say a note the grass footsteps are the same ones from minecraft so when i made this video before i said that they sounded like the ones from minecraft but i wasn't sure i've looked into it and they are actually the exact same ones they're all free sound of minecraft found them and use them however the license on freesound is still the same close that change the wood ones as well to be you would footsteps there plugging them in there like so and so now we have our footstep sounds set up for how we want so what we want to do next is you want to set up our physics materials or our physics surfaces so we have our grass wood and concrete we want to actually determine that these are those in the engine so the code knows which is which we go to edit project settings and once this loads we're going to scroll down until we find physics here so it should be under engine go down to physics i'm going to scroll down until we find physical surfaces now i already have these but what for you it would just be non and you can change non to be would whatever you name it so it will be none like that i'll press no but you can just change it from non to the one you want so i need word grass concrete dirt sand anything like that and now the name doesn't actually matter too much you can name it whatever you like if you're using on wood it doesn't need to be named wood but obviously it just makes more sense to give it the correct name and then once you've set those up for the amount you want again we can have a maximum of 62 not 52. like i thought earlier so it's 60 that's the maximum we can have so you put in the amount you'd like then we close that now we'll set up the actual physical materials so that's the surface and we'll do the material so we're going to right click go to physics and we're going to create a physical material select the physical material there hit select and i'm going to name this one grass pm the grass physical material and open it up and actually i'll minimize it as well right click duplicating it naming it naming this one concrete pm and right click duplicate that and get wood pm and then we're going to open all of those up like so in here with the grass pm we're going to change this physical properties surface type down here from default to grass save and close that that's how easy it is to create a physical material we close that change wood to be our wood physical surface there and concrete will also be the concrete there save and close it so now we've got our physical surfaces and material set up we need to designate this to be the material we want so to do that that's also very simple you see here i have grass wood and concrete textures or materials so i'm gonna do is just open those up so i'm gonna select this double click my material there to open up the grass material what i'm going to do is the physics material down here so under physical material you have material there i'm going to select non and set it to be my grass pm which i created i can apply and now that grass material in engine is also physical grass material so now this is known as a grass physics material and close that and i'll do it for the other two as well so wood double click that to open it up change the physical material to be my wood pm and apply that again setting this all up is incredibly simple it's very easy to do it's very simple to understand as well close that and do it for our concrete as well you see they're just compiling there just because they're updating to be this physical material inside of it as well apply and that should be that part done for actually setting up the physical material parts so we've designated surface types materials and put them inside the material as well so we can close that and what we want to do next is you want to actually set it up to determine which one to use so we want to find out if we are above or if we're walking on grass wood or concrete so we can do that in our character blueprints we go to content first person bp blueprints first person character and then as you can see here this is the code that we created last time so again if you don't have this i'd recommend getting it what we're doing is off of our movement inputs we're just seeing if we are moving and if we're not jumping and if we are just going to play a sound effect with an interval that we can set so just underneath this code we're going to right click and add a custom event and i'm going to name this check physics material you can name this one if you like so check material or anything like that but check physics material makes sense for me out of this we're going to get a line trace by channel the start is just going to be get act location so from the player's location and then for the end we're going to come up get x location and get a vector minus a vector and we're going to take away 144 off the z now this might be a different value for you and your character is basically just the height of the character so it reaches the floor 44 is usually a good value which works however for me that isn't working in this example when i tested it earlier so you just messed up the value until it reaches the floor so this is now going to draw a line from the player all the way down to the floor to then obviously see which surface we're on so we can do is hold down b left click to get a branch plug that in there with condition of the return value so if we do hit something we're going to fire off and the out hit we're going to get surface type so if it has hit something it's going to see which surface is hit which is using our physics surfaces which we just made in project settings out of the return value we're going to switch on e physical surface plug that into the true there so now it's going to see which surface we're on so again very simple to do we're hitting the floor and if we do we're going to see which surface the floor is default we're not going to do anything but you can set up just a generic sound effect or no sound effect if you'd like but for the wood grass and concrete we're going to change our sound effect so instead of playing a different sound here what we're going to do is we're going to come up here until we have our play sound at location we're going to right click on the sound promote to variable and name this one footstep sound effect leaving it plugged in there so we can just change this variable to be a different sound effect to again keep it nice and efficient compile and save that if we scroll back down here to our switch for physical surfaces we're just going to set this out of all of them so wood we're going to set footstep sound effect out of grass we're also going to set the footstep sound effect and the same for concrete there and again you can do default if you'd like however i'm not going to bother so all we can do is our wood we're setting it we want to set it to our wood cue out of grass set it to our grass queue and then concrete we'll set it to our concrete key so now apparently i don't have a concrete cube what did i name it uh yeah i spot the key wrong okay there we go i missed a c in it now concrete cube there so as you can see we're going to be setting the correct sound effect depending on which surface we're on which will then play the correct one up here again using the code we made last time and that's it done it's very simple so we're going to select this hit c to comment it and i'll just do check physical surface for footsteps like that move it up and then we also need to call this so what we're going to do is out of here so off the add movement inputs we're going to come out this call function check physics material or whatever you name this down here and then we're going to plug this into the branch so it's just going to check the material whenever we want to move and play a footstep sound effect so we compile and save that and this should now work perfectly for us between close hit play to test this we felt we got a normal sound effect we walk around this is the sound effects we set up last time if we walk on the grass we get the graph effects we walk on wood we get the wood sound effects we walk on concrete we get the concrete sound effect so this is working perfectly for us so i think that'll be it for this video if you've done everything you want to do we set up this dynamic system in which we have different sound effects on different surfaces i.e concrete wood and grass in this example but again it's very easy to adapt on and add more and as many as you'd like so thanks so much for watching i hope you enjoyed it i hope you found it helpful and if you did make sure to like subscribe down below thanks so much for watching the next one
Info
Channel: Matt Aspland
Views: 17,708
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, games design, ue5, unreal engine 5, sfx, sound, sounds, effect, effects, foot, step, steps, footstep, footsteps, dynamic, different, surfaces, materials, material, surface, grass, floor, ground, location, system, different sounds, different surfaces, ue4 footstep system, wood, concrete, for, first person, first, person, no, mesh, animation, animations, no mesh, no animations, and, true first person
Id: ShY8hRNmMxM
Channel Id: undefined
Length: 10min 44sec (644 seconds)
Published: Fri Feb 19 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.