How to make hit sound/Impact comp based on object phys material UE5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right welcome back or welcome to my Channel or welcome back whatever it is um hopefully this isn't too long a video I'm going to show you how to make an impact component that um collides so when something collides with something it'll make a sound and it'll be specific to a um a material type thing so like if it's metal it'll hit the metal and if it's concrete it'll sound like it's hitting concrete based on the sounds you have to make the sounds but well I have sounds that you guys can have but it's not mine not my sounds but I can put them in the description for testing purposes so first thing you're going to want to do is uh if you haven't already make a main folder I Nam minecore main I set the color to that um make a called make a folder called Blueprints and then you're going to components okay so in the components folder you're going to want to make a BL a blueprint uh uh class I can't speak English actor component and you're going to name this bpc impact component component imp yeah impact component you don't need those those can just screw themselves you're going to make a custom event this custom event is going to be called impact event um and this will be the heart of everything you're going to want to make three variables first one would be called velocity velocity I can't spell for the life of me no not velocity to Velocity thank you make that a float location make that a vector not a text a vector and then hit event so you're going to want to name that hit type in hit hit result and that's the starting so you're going to want to create two variables right here one called velocity Min and veloc velocity velocity Max the velocity Max will be 500 and the velocity men will be 30 so make sure these are set um also put instance editable and expose on spawn that's very important and right here changeable and then go right here click the drop down changeable and these are just so it's easier to see so from from this part um you're going to want to do that and click B which will create a branch so from the condition you're going want to do more than or equal to and you're going to want to get velocity so if velocity is more than or more than or equal to Velocity min if it is then we're going to want to create a sequence which is um multiple things at one time which allows us to do a delay which drag out click D or just type in delay it's not hard um you want to do random float in range and this part is just to make it so it doesn't spam and hurt your eard drums real bad that is not what I wanted okay well I guess I'm going to have to actually type it in fine do once there we go put that on reset and then there so this part is to stop the spam and we're going to signify that by um PR prevent spam so that this will prevent the spam and it will stop it from raping your eardrums to say it lightly on I'm kind to get taken down for that one uh we're going to need a is valid node right here not that type of is valid is valid this one with the question mark because we're going to want to spawn sound at location and on the sound we're going to need a select node and that's going to need to be there there so we're going to make this look nice because in Unreal Engine everything needs to look nice otherwise you're a maniac it's really simple uh man I don't know how to make this look nice there we go all right uh oh yeah nothing's in index so we're going to want to drag out hits and actually I need to show you guys how to do something first so you're going to want to get edit project settings um and on Project settings you're going to want to go down to is it physics yeah physics okay you're going to want to go to physics under engine and under physical surface you're going to want to make them so I made them already because I already recorded this and realized that it didn't show my screen because I'm slow um you're going to want to make them and once you plug in the hits it will not work because this uh games or this unreal what the hell oh yeah you need to get surface type I'm slow get surface type okay so you want then all of them will pop up right there so I'm going to make this down okay and these are the sounds and right here I'm I'm just going to type I'm just going to plug in location right now so make sure you plug in location to location um so that works and honest yeah so we're going to set the sound to be uh higher and lower based on how fast it hits I'm thinking so drag on that and type in map ranged clamped and right here we'll type in 1.5 and 0.1 um get velocity Max put that in a velocity Min put that in B and put that into volume multiplier and we're going to we're going to name this set sound to be higher slash lower based on velocity yeah and that'll do exactly what the name says it'll set sound to be higher or lower based on the velocity and so we're going to need to make these so we're going to promote a variable we're going to default sound and we're going to instance editable expose on spawn and name this sounds because we don't want them to be in the changeable because that's going to be a bloody mess and so so right now you can skip this part so you're just going to just going to duplicate them consistently till you get all your concrete all your sound set up concrete sand wood metal Okay so so grass goes to Grass obviously concrete goes to concrete sand goes to sand wood goes to Wood oops metal goes to metal not wood metal goes to metal and this way it'll show up and that promote attenuation settings to variable instance editable expose on spawn changeable okay um I'm thinking that should be it get and set look get and set sound based on Fizz material um and I I like to comment my things just so I know what they do um impact event it's always good to get in the habit of commenting because if you ever work on a team or anything at some point it'll be useful for them to know what it is and what it does as well and it's just good all around so now that we have this done we have the component done it works fine it looks good it looks beautiful um you're going to want to create a blueprint class unless you already have one obviously but I'm going to create an actor called this bpor Cube I'm going to open it so I'm going to make a cube and there's a very very important parts that you need to keep into consideration when you simulate physics you need to scroll down you need this enabled if this is not ticked it will not work this is very important simulate simulate generates hit events make sure that is ticked okay once you have that you need to add the impact components and you see all of our stuff right here and my headphones turned off which doesn't matter it's fine um if these aren't here I'm going to turn it on again though if they aren't there then you did something wrong you probably didn't click instance editable and expose on spawn or you just have to scroll and find it but and my Xbox turned on hold on so you're going to want to set these but we don't have sounds yet so sounds I'm going to make a link to make a link to these so we going to right click is that right yeah right click and create CU so concrete I'm going name it default default default Q so you see how it's all basic and it doesn't just playing the same sound we don't want that so we'll type in a modulator and what a modulator is what a modulator is you let me speak English thank you is it does that it changes the pitch guarantee that's how Minecraft does it in their different way but it's quite useful changes the pitch you want to change that to that get Cube on component hit in on component hits you're going to want to get impact components impact event and this is the event that we just created put hit into hit you're going to break hits and put location into location and for the velocity we're going to want to drag out cube or the mesh that you're using to make the sound you want to get component velocity and since this wouldn't just plug in we need to make it length so Vector length which turns it into a uh float plug that in and it should work theorically impact comp so so if we put the cube in we put it up a little bit we simulate it works try that again I don't know if yeah you guys can't hear that can you okay I got to change my hold on audio capture device first monitor there we go okay you guys should be able to hear now yeah there we go you guys probably couldn't hear the queue either there you go you can now but it works really well I mean you can just throw it around you can hear it and stuff it's a pretty good component it's really useful for this it's quite useful for VR as well if you're uh making a VR game and you want it to you want your objects to make a sound it's quite useful I use this on all of my games that need it and uh this is going to be the end of the video Jesus loves you I love you that doesn't sound weird don't make that weird have a good one
Info
Channel: Tommyboi7566
Views: 18
Rating: undefined out of 5
Keywords: Unreal engine 5, UE5 tutorial
Id: Crlg7GegcDI
Channel Id: undefined
Length: 13min 59sec (839 seconds)
Published: Sun Jul 07 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.