Unreal Engine 5 - Punch and Kick through walls using Chaos Destruction

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to icy 3d people today we are going to kick and punch through some walls using the chaos physics in unreal engine 5. let's have a sneak peek take that wall give it a kick give it a punch what about another kick all right let's jump into it so the first thing i want to talk about is how we set up these walls two different walls and they're set up differently in terms of the amount of fracturing so if we um click on uh this activate fracture editing mode it's going to give us the options for fracturing these walls also do note the fracturing mode is enabled by default but one of the items that you will need for this is not which is the chaos field system so that's not enabled just tick that restart your engine and you should be good to go so once you're in here uh let's have a look at the two different walls the important thing to note is this one here is has two levels of fracturing level zero which has the one solid piece and the way we can actually show that is if we go to bones click on show bones it's going to show that so if i come up to here the fracture level click on zero that's how many times being fractured one you can just see the one piece if i click on level one you can see there's a hundred pieces now if i click on this one over here there is four levels of fracturing going on level zero level one level two level three uh and it's very similar 1 100 400 but this is where it gets different 438 939 and what that means is it's clustered so it's kind of a way of um having better performance so at 100 it works okay if i was just to do one and a thousand or one and 500 it would be very slow and even now it is pretty slow on my system so depending on your computer your your mileage may vary now the important thing also other important thing to note here is these levels relate to the damage so when we jump into the the damage that i'm going to type damage here and you can see here i've set up four array elements so 180 50 and 30 so these are how much damage it needs before it breaks apart this is how much force it needs for it to break apart and and i will show you within our external frame uh exter external strain field um where we set that but that's coming a bit later the the way this is done so i'm just going to click back on this one reset the first you need to think you need to do is click new and you need to create a new piece of geometry i've already done it so all you need to do is click correct that's all and then that'll give you the ability to um fracture so you can select all it's going to select all the pieces and then you can choose the different type of fracturing in this case i'm just using uniform and then down here you can set the number of fractures so you can do this higher or lower depending on what you want but again as i said the higher you go the the more it's going to struggle and in fact i think my computer's frozen yes it's back okay so we can go back to 100 um and [Music] we're getting a hundred fractures here so i'm just going to leave that as is um i'm going to fracture so you've actually got to select it fracture and now it's fractured um and there we go so i'm just going to click back on there and i'm going to keep these bones showed so you can see now if we click play the difference in the level of fracture now these two these two um walls have very similar performance um that's because the the right one does have the clustering set up so we kick that you can see the pieces are very big whereas we kicked this one the pieces are much smaller and that's just because of that fracturing and the way we've clustered that so the next thing we want to look at is in these actual geometries we need to set up the type of collisions and so to do that we can click on here click on into our uh geometry and then we can set the collision type and the implicit type so i've used particle implicit and i've used level set there is a few types of um collision here that you can have the only one that i've really found to work is a level set the other ones just seem to explode and do really funny things so level set um you can try experimenting with the other ones other thing to note here is the fields that we need to use so you can see here attached to these two walls is two anchor fields so the anchor fields are is this blueprint here and it's referencing this field here and this reference this field doesn't really do much other than to identify that this blueprint is a anchor so i'm going to open up this blueprint um and there's not much to note here other than in the construction uh of the blueprint what we are doing is setting a construction field and we're setting it to dynamic state and we're setting a culling field of outside what this does is say to the object everything outside of the box out of this collision box i want that to be dynamic everything inside it i want it to stay as is and not apply any physics to it so it's going to lock it in place and everything outside of it we're going to keep it everything outside of it we're going to let the chaos physics go as intended you can also see here by clicking on the field system component you can see the field system that we've created within the content area it's important to note to get the anchor fields working with the wall you need to set them as initializing field so to do that select the wall type field and under initializing field you can create an array as many as you need and set the anchor so i've used my bp anchor and my bp anchor underscore too so two instances of my bp anchor the next part is a force field um that we've set up so this fourth field i've taken from the unreal marketplace chaos destruction demo and i've upgraded it to unreal engine 5. and the two things to note here is the um the strain magnitude and the force magnitude so as as i was talking about before these are the things that are defining um whether or not they uh break and how far they move the pieces so i've just clicked on the details window to sh to bring it up um and here you can see force magnitude i've put this down to something quite small 0.01 because i found even that can be quite a lot and it will send rocks flying everywhere so 0.001 or is fine and then i have the strain magnitude which is the the the amount of strain is exerting which is 100 and that is directly related to the damage on the wall that we set up before so the next part of this is how i set up the mannequin so in the mannequin i've used two animations a cross punch and a kicking animation which i've taken and converted from miximo and retargeted i've also created a montage out of them because uh there's a special duration node that i want to use so i'll jump into that now and i'll show you let's go third person bp in here we have an input of action punch so in the input manager i have created two in inputs two actions one's a punch one's a kick they're both bound to the left mouse button except the kick also needs uh shift to be held so in order to what i've done here is put an event based off the punch when that's clicked do a check to see if something's already attacking if something's already attacking do nothing because we don't want to keep we don't want to allow the animation to keep clicking on it and keep firing off the same animation so then only when it's not already in an existing attack let's go through false which means let's play that animation montage which in this case is a cross punch so what we're going to do then is set the attacking to true to say nothing else can no no other attacking motion can play while i'm doing this and then what i want to do is um come over to the sequence i want to fire off a delay and hit that link that duration up to this animation uh montage and what that'll do is then only once that animation is finished destroy the actor and the actor is this one down here which i'm going to get into a second uh after we've destroyed the actor i want to set attack into false and punch to false because we're finished with the um with the animation so during that time of the animation i want to put a delay of half a second because i don't want to spawn this um actor right away i want it to be at the end of towards the end of the punch and then that's when we're saying okay we are punching or that's when we're saying the punching is activated with the force field and then this is where we actually activate that force field so that field that implies the strain and the and the linear force this is what um this is uh where we spawn it and then we attach it the next part is we're going to attach it to the hand um to mimic the punch so down here um we also have an event tick so what we're going to say is on each event tick let's check to see if we're in the middle of a punch if we are then let's update the location of a actor which is this spawned actor we're going to uh keep updating the location to be in line with the fist and the location is dependent on the right hand collision so in the viewport i've added two right two collisions um one for the foot and one for the hand and you can see it here so right hand collision and um and right hand foot right foot collision and i've put those below just just sort of below it because it's the center of the mass which sort of activates the the strain and so if you've only got the edge of it i've been i found that sometimes it doesn't actually activate the um the strain against the the chaos material the chaos destruction i've also set up my collisions to be attached to apparent socket so here i have hand under scroll r for the hand collision and under the foot collision i have set up the parent socket to be ball under scroll r and this will just allow it to follow the hand and follow the foot when it's moving in the blueprint back into the event graph i've copied this punch and i've put it down here below and it's exactly the same thing the only difference is the variables down here are now defined defining the kick instead of the punch and the location of the actor is now at the foot instead of the hand and it's the same principle so once we've done all that we're basically ready to go and we can start punching and kicking our way through the walls and one more demonstration just to show how it works let's get closer and there we go i've left a link in the description for the project files download it play around with the project and see what you can do until next time guys please like subscribe and hit the bell notification thanks see you around you
Info
Channel: I See 3D
Views: 49,521
Rating: undefined out of 5
Keywords: asset, asset store, epic, epic games, free, game development, game engine, gamedev, marketplace, models, stylized, tutorial, ue4, ue5, unreal, unreal 5, unreal engine, unreal engine 4, chaos, destruction, fields, wall, kick, punch, blueprint
Id: qEhSZRJon8M
Channel Id: undefined
Length: 12min 12sec (732 seconds)
Published: Sat Aug 14 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.