Unreal engine 4 Gore system / dismemberment TUTORIAL

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay so this is going to be a tutorial for unreal engine go so what you're going to need is ballistix vfx and blood vowel effects pat you don't need these you can use your own but i'm going to be using this for the um the blood splash effects and this for the blood pool decal so um let me get rid of this and this okay so what you're going to need is um okay so we're going to use a third person character it's pure from base we've just got rid of the character so what we're going to do is duplicate and we're going to get rid of the camera we're going to put in the mannequin let's put the sk medic in and give him third person and mvp so now we can call him ai man so from here what we need to do is we need to create a function and this function will contain uh this function will contain damage hip bones and the coils so let's get rid of this because the ai doesn't need to move so let's call it any damage and this function will be called in our line trace where we actually fire so we need one two three three inputs first input is damage second input is um hit bone name that's going to be of type name and we need damage closer and that's going to have type actor object reference so promote each of these to available it's going to be applied damage hit the name and damage causer okay so from here we need to uh we need to create another function this function is basically just going to change a few things with the mannequin because right now if we have something like spine o2 dismembered you see it causes deformation because of the waiting same for the head and um a few other limbs but what we need to do is basically tell the tell it if you do hit these just ringing just point towards spine 01 because that's the one that has correct weighting but you could skip this step if you fix this yourself but for now let's just create a new function called rename name in this function we need to do we need to get hit by name and switch our name now we need to give it a list of outputs and these pin names will be pelvis spine issue um o3 you could go check these right now and see for yourself the issues they have we need neko one and head and head okay from here if it does return true on any one of these we need it to target spy on score over so from here let's call rename bow name okay so now once it's gotten past this function um what we need to do is basically have a way of actually applying damage to each limb because each limb is going to be independent with its own set of um its own set of values for example health and durability so let's call this apply damage to bone okay so from here what we need to do is create a new variable called breakable bone slash durability and this is going to be of type name and it's going to be of type map and it's going to have an integer and a name so compile now you can see we can add elements so we need to okay so we need to go give it some inputs spine01 of type of 20 we need to do let me just keep making these you okay so now we need 15 15 10 and 10 you can you can obviously set your own values but i find these values work best fifteen and fifteen um ten and ten five and five so now let's let's call this and we actually need to find through this index the bone we have hit so then from here let's check if it's actually true and if it does return something let's get our applied damage subtract it from the list make sure this is in the top input a this is in input b so if you do the other way around we're gonna get um negative values and that's not what we want so now we need to get our list again and actually add so we're going to input this back into here so it updates its values and let's get hit bone name for this and if it's true add it to the this okay so now we actually need to have a way of checking if it's reached this limit because if it's not reached this limit we don't want to get past its function because after this function we're going to actually be actually dismembering the bones and breaking constraints so we don't want that to happen just from hitting the limb once because if it has gone past its limit then we should be able to break constraints so fine and find hit burning and if the value is less than or equal to less than or equal to zero we need to get return this way um we actually get this output outside the function and let's call this reach durability limit okay yeah that's it for this function so now if we go back we can call this function and check let's refresh this and yeah okay so now what we need to do is check if it has reached this durability limit because if it has now we can proceed onto dismemberment so create a new function call it dismantlement so in this one we need to get our mesh and break constraint now what we need to do is get impulse so we want it to push the limb away once it's actually been broken and hit location we need to know where it's been hit from so that way we can impulse from the angle and we need to actually know what bone to break so first let's get impulse so let's create a macro because if we make a macro we can quickly have because we're going to be doing this quite a few times we're going to need a way of quickly accessing a small little function instead of making a function we can just create a macro so let's call this calculate impulse uh get player camera manager get actor rotation here is forward vector and multiply that by float and we're going to get a random integer range this way gives a bit more of a procedural feel so 80 000 to 110 000 and then vector plus vector multiply this by float and get up to up vector so now what we need to do is get random random float in range so from 5000 all the way up to eight dollars so now we just need our output and that will be the return value so now we can plug calculate impulse into impulse and now we just need hit locate hit location so for this we can make a new macro called get socket location and what we just need is mesh get socket location and the socket name will just be the hip burn name and plug this into return and plug that in there so all we just need now is the boat name we have hit so now we can get onto the visual side so let's get our circuit transform of the bone we have hit and let's split this because we just need location rotation so now let's spawn emitter attached this i'm going to use the the pack the fx blood valves pack i'm going to use arterial arterial loop um let's plug this into location rotation and rotation attach the component is going to be mesh attached point will be hit burn in make sure it's keyboard position okay so from here i'm going to multiply the scale up by two you don't need to do that so let's copy this paste this and now we're basically going to lay our particles blood flow and this will basically follow along with the burn so let's get our location again rotation okay um i'm going to leave the scale at one attach point name it's going to be headburn name attached component will just be mesh make sure keyboard position is still uh it's still at a keyboard position and lastly we'll i'm going to do another one and this is going to be the initial blood effect of this like a blood spur when the limb is dismembered so bloods but o2 okay same thing here same thing here okay so now we need to check if we're going to have a check if our spine has been broken because we're going to be referencing this later we're going to have a special function that happens if the torso has been torn off we want a different state of movement so let's check if it's equal to spine01 and if it is let's promote this to a variable pull it has spine broken okay from here i'm going to get hip bone in and we're going to create a new variable and that's called broken bones and it will be of type name and array so it's going to be a list so we can leave this empty because it's going to be updated automatically so i'm going to do add and it's going to be updated by the hippo name so from here now we're going to have a line trace casting downwards and this line trace is going to basically spawn in the decals for blood for blood pools so what we need is mesh um get a world location from here need vector plus vector and from here we need a vector plus float at most paragraph flow and it's going to be -1 the z-axis minus is on the z-axis is down positive is up so minus one and it's going to be a thousand okay so now let's get line trace line trace by channel so that will be the start uh necessary that will be the end and the start is just get old location from here let's okay yep let's break hit because we want to access what is hit from here what we want is spawn decal at location and it'll be type of blood splatter location is just location and for the rotation we want the normal the normal of the surface the i'm going to use the preset values 63 minus 128 and minus 1 3. and last span will be 60 60 seconds so from here that's that's it for dismemberment so we need to call this if reach durability limit is true so now what we need to do is create another function called change movement type because we're going to have normal and crawling or clawing states so what we need to do is go here uh into blueprints enumeration and enumeration just holds um it just holds states and we can call this movement states so two states normal and chlorine and the way we can access this is by creating a new variable this is going to be called the movement zombie and let's just type and you can see with it make sure it's not tab array makes you a single variable so from here we can get and check if it's equal to normal by default it is so from here if it's true let's set the movement to chlorine okay from here that's it so now we need to call change movement type okay so now what we need to do is actually apply physics so apply physics so from here let's get hit bone name switch on name and we need to input so this is going to contain all the types of bins that can that we can actually um have physics applied to okay so let's have paste so these so foot l foot are called cuff l thigh l thigh r spine one from here we need to simulate physics set simulate physics have that in here and make sure it's true from here we need to add impulse at location and like i said before we can use the macros we've made calculate impulse and get socket location hip bone name is just hip bone name bone name is hip bone name yep and lastly we want to disable capsule component and make sure there's no collision so now that's it for this this um any damage function now we need to go to event graph and call tick so untick what we need is a check so let's check if we are in the clawing state is equal to join if it is let's get a sequence so we're going to be doing a sequence of things so do once and delay so we want to be able to open the gate just once so after three seconds it's going to open this gate make sure it's on open and they can enter so after this what we need to do is create another function and is going to be called set capsule location this is going to get a set world location and it's just going to get the mesh get the socket location and it's going to get the head plug that into new world new location so that's it for that and on exit just set capsule location so now we need to actually have the zombie crawl towards us so what we need to do is create a function and this will be called add force to bones so what we're going to do is just calculate the [Music] the zombies location and apply force to the limbs and that force is going to be following to the character's position and offset so what we need to do is get mesh add force and it's going to calculate the force by a macro we should make and this will be called calculate crawl force so what we need is capsule component get location find the cat rotation and the target will be the damage causer so just get back to location and that's our target so from here we need to get forward vector multiply that by a float so that float will be multiplied again by float and we're going to have a select select float and it's going to be based on has the spine broken so 1 and 1.2 should be the values and here let's just have our input because we want to be able to define how much force to use so we should have two forward force and output force output force float so from here what we need to do we can copy and paste this and that shall be this value okay so now let's do vector plus float uh vector plus vector so and we can split this because we only need the z-axis from here plug that into output and that's it for the macro so now we can get our forward force is 500 and output forces three thousand acceleration change so this would just add on to any uh existing um force and hip bone name would just be uh our bone name would just be head so we've got that now let's make another macro and this will be called fine broken bones so when you find the existing broken bones we need an executable pin and we we need a bird name pin this will be our type name and of type array so we need to get a copy and check if broken bones contains item if it does contain either one of these so we need an all boolean and if that is true then we can put those in the outputs so if we go back let's call find broken burns so now we need to make an array and this will contain our defined bird names so we need upper uh uh lower arm r and hand r and if it does return true on any of these we can continue on but if it returns false we can add add force to mesh and what we need is our calculate crawl force so we're going to have it one thousand and one thousand acceleration change is true and it will be hand up okay from here what we need to do is copy and paste this again and untrue as well make another array this time it will be for our left side and if it returns false we should add force again we should calculate crude force and it would just be for hand and yeah give it a mesh target and that should be it for add force to burns so now what we just need to do is call this so lastly for visuals we are going to have blood pools spawn as uh as the zombie crawls along and what we need to do is get mesh get socket location and hit by name so this should happen uh every one second so let's get line trace by channel so the start will just be the bone name socket location and what we need to do is the vector plus vector uh times about float and type a thousand and minus one on the z-axis so pointing downwards so that will be our end point okay so from here let's break let's access its data so spawn decal at spawn decal at location so wherever it hits we want it to spawn location into location normal interrotation and it will convert and we need blood splatter uh lifespan of 60 and i'm going to use minus 31.5 64 and 64. we don't want it to be too big so that's it for now what we need to do is lastly go into our mesh physics tab and now we just need to give our bones make sure you enable mason kg and type 100 from here what we need to do is actually apply this any damage function because right now it has no way of being called we need to call this any damage function and let's do that by adding we can if you already have a weapon system you can easily add it but we are just going to quickly create a simple firing system line trace by channel get follow camera get toward location and get forward vector as i start vector uh just multiply by fluid but 10 ten thousand units forward and that's our end and for duration break it let's access so what we're going to do is go to our project settings physics and make sure you make a surface type called flesh let's make a physics um physics material called flesh so this is going to play anytime we hit something that has a flesh surface type make sure you sit flash so now we go here and now we can firstly hit activate let's cast to airmen if that returns true let's call any damage and damage let's have it at two hit bone name is hippo name damage cause it is us so get a reference to self from here let's get surface type and let's switch actually let's do a select so it's a more cleaner and then let's just spawn emitter at location and that will be bullet tip uh plug it in here let's just do it here bullet hit okay location is just location and we don't need to change rotation okay that should be it and we can test it out now so let's drag in our air man actually there's one problem what we need to do is go over here make sure you select physics actor because what we need to do is actually have him as a physics body and it should ignore pawn and vehicle make sure it does block visibility one thing we need to do is flash we forgot to apply physics okay yeah and yeah you can see him crawl towards us simply that's how you do it you could obviously play some sounds uh play around with it yeah you could see um it updates and it spawns in those particles and it spawns in those decals every one second as it crawls towards us thanks for watching that's it for this tutorial
Info
Channel: Eazily Unreal
Views: 48,923
Rating: undefined out of 5
Keywords: unreal engine, unreal engine 4, ue4 dismemberment, unreal engine gore, ue4 gore, unreal tutorial, ue5, unreal emgione 5, unreal engine 5, ue4, unreal gore, unreal engine 5 tutorial, unreal engine 4 tutorial, unreal help, unreal package error, unreal debug, unreal protottype, unreal engine game, unreal tutorial 5, ue4 help, unreal package, unreal error, unreal blueprints, unreal engine bp, main menu, matt aspland, easy unreal, unreal engine main menu
Id: Nt7r2OD8pUQ
Channel Id: undefined
Length: 35min 21sec (2121 seconds)
Published: Sun Mar 13 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.