Left Hand IK, Weapon Sway, Procedural Recoil, and Third-Person Poses - Unreal Engine 5 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys mizo frizzo here and firstly I just want to say Happy New Year I hope you are all doing very well and I also want to say thank you to the very generous people who made donations to my channel via the super thanks function in YouTube I appreciate it very very much it makes it easier to do what I do and as a result I am very proud and very excited to bring you what is part 14 of my true firstperson shooter tutorial series but is also a standalone video for anyone who wants to implement this stuff which uh what I'm going to show you in this tutorial is leftand ik so locking the left hand to your weapon as well as adding some weapon sway as you can see here when I look around and move to the side I've got some weapon Sway and the left hand is following the weapon and also if I fight I have some procedural recoil here so none of this is animation this is all procedural and it looks very smooth and very nice and adds another level of realism to our project so I'm very excited to show you this stuff today um just before we get started guys I also want to mention that I have created a subreddit called mizo frizo tutorials and there is also a face Faceook group called misof frizzo tutorial discussion so I know that many of you don't use Facebook um I unfortunately have to use Facebook so uh that one is there as well but there's also the subreddit misof frizo tutorials so if you want to get on there and share any problems that you're having for debugging or you just want to share what you've created I encourage you to search out that subreddit and join up um so without further Ado guys let me show you how to do this all righty guys let's start by doing the leftand ik um we'll just do it for one weapon so I'm going to do it for this assault rifle here the very first thing we can do is find the skeleton of the weapon we want to do it with so I'm going to open up my assault rifle B skeleton and just um I've got this leftand socket here which I made before but I'm not going to use that one I'm going to right click on the root and add a socket I'm going to call it say leftand ik all caps it's just something easy to remember which I can give it the same name on every weapon so we don't need to keep searching for different socket names much like when we made the barrel or muzzle socket um and I'm just going to put this um about here just under and to the left of where I want him to grip the weapon this is the hand I so it's somewhere near the wrist um and we'll we'll adjust this later on so we'll leave this open for now um and the next thing we want to do is set up an interface for our animation blueprint to find that socket location so what we're going to do if you have followed along you should have an interfaces folder uh in underscore main I'm going to right click and go to blueprint blueprint interface and I'm going to call this one BPI uncore character data so this blueprint interface is going to be the main one that we use to basically get data from our characters blueprint it's going to be used by our animation blueprint to get uh data from our characters blueprint so I'm going to open this up and I'm straight away going to name this first function uh get leftand ik um and it's going to have one output it's going to be a type transform and again I'm just going to call this leftand ik um You can call this whatever you want leftand socket transform whatever um but left-and ik and it is type transform so I'm going to know what it is uh I'm going to compile and save that and then in my characters blue print I am going to click on class settings and interfaces over here add that new interface that we just created BPI character data compile and save and then here under interfaces you'll see that function get leftand ik we can open this up I'm going to make quite a bit of room here and the first thing I'm going to do is get my current weapon I'm going to right click on this and convert it to a validated get so we're going to check if we do have a weapon if we do have a weapon we're going to get the skeletal mesh component which for me is weapon model get weapon model and then we can get socket transform and in socket name is going to be our leftand ik and and we also need to grab our body our skeletal mesh whatever we're using here is our body right here I'm going to drag that out and I'm going to uh it's um transform to Bone space transform to Bone space um the hand the bone name here is going to be the right hand which is handcore R you have to make sure this is exactly what your right hand bone name is in your character skeletal mesh um we're also going to right click on this get socket transform and split it and we're going to plug location into in position and rotation into in rotation like so uh and then we're going to make a transform from this make transform plug in the position and the rotation like so and then this return value is going to be the leftand ik that this function returns nice um all righty let's go into our animation blueprint now so I'm just going to find um probably the easiest way for me is in here I'm going to browse to my anim class and open up my animation blueprint and where we're going to be working is just in front of this layer blend per bone um so we're going to apply all of this stuff to the upper body um and we'll do it before this before this uh default slot right here so what we need to find is a node called two bone ik and we also need to find one called fabric we can plug these in you get this local to component and then component to local nodes um and what we can do is drag off of this effector transform on the fabric node and promote that to a variable and I'm just going to leave it as effector transform uh we can also get that effected transform or you could duplicate this one and I'm going to write click and split the struct pin and plug the location into the effector location right here there's a few things we need to change in these nodes uh we can click on the two bone ik node what we need to do is change the ik bone to the left hand handore L uh the affector location space will be bone space and we can check take rotation from uh effor space and effector Target uh is going to be the left hand joint Target location space we need the parent bone space and the joint Target will be the left upper arm all of this stuff needs to be exactly like so to work correctly um we also in the fabric node can make a few changes here the effector target is going to be the right hand and effector transform space is going to be bone space effector rotation Source can be change to no change preserve existing component space um the tip bone is going to be the left hand and the root bone is going to be the left clavicle okay um compile and save you'll see he's doing some funky stuff here uh we haven't actually got a weapon for him to uh grab onto yet so pretty much ignore the preview here but we do need to make a change to this joint Target location so the effector location is obviously zero um in here the default is going to be zero um but this is what we're setting in the um you know in the blueprint interface function that we set up um so we're just going to select the twoone ik here and just change so you've got two um transforms you'll see here two transform widgets uh I can't really locate the other one where is it should be ah it's just kind of thought it might be hard to see but I can't actually see it there um there's joint uh Target location so it's kind of hard to see there there we go I don't know where it was I couldn't locate it but um you can see this other one here and this is going to be um the ik between the clavicle and the left hand so basically the elbow um you can have a play around with this as you will have a play around with the leftand ik socket on your weapon um but that's pretty much all we need to do in here we just need to now um grab this effecta transform from our um in the event graph from that blueprint interface so you can drag off of the character reference and you can find and the get leftand ik message that's the blueprint interface right here I'm going to plug it into an execution pin on the sequence and then I'm going to set the effector transform as the leftand ik right there and that should be all we need to do if I see it's it's um we can set up later to not do the okay if we don't have a weapon for example um but I'm just going to grab this weapon and if I press f8 to eject and grab the skeleton here I can now adjust the leftand ik socket on the skeleton um just going to you can move this camera around and adjust the left hand ik to be exactly where you put it in your animations nice that's pretty good um I haven't actually set up this animation to look good from third person we're going to do a bit more of that uh together towards the end of this Cho and we're going to take the realism uh with all the hand Sway and the procedural recoil and some realistic poses for the animations we're going to take our third person shooter to the next level very very excited to show you guys this stuff so let's go on to add some hands sway the first thing we need to do is go back into our BPI character data and we're going to add a new function and we'll call it uh get hands suway data Call It Whatever You Like I'm going to call it this uh we're going to need three outputs all of type float so if you change the first one to type float and then add two more should all be floats um first one is going to be side movement and the next one is going to be Mouse X and the next one Mouse y okay we can compile and save and close that we're not going to need that anymore and then um in the under interfaces over here you've got this new function get hands sway data we're going to open that up and we're going to promote each of these to a variable not a local variable just a variable promote all these to a variable and then back out to the event graph I've got a lot of tabs open here um and we're going to do this on uh tick so I'm just going to find tick here we go event tick there it was um now it's very rare that you want to do things on tick um that you know it's not very performant if if you're doing stuff on tick that doesn't need to be on tick um but this I I kind of think is a rare example of something that should actually be done on tick so we're going to set those variables that we just created on tick and what we can do is get I a move and you'll see under enhanced action values I've actually got two here um because I've I added the third person and the first person content um I might actually just to eliminate any confusion here and the possibility of mistakes um what I'm going to do is on my event begin play here where I've added the input mapping context I'm going to browse to that and then make sure this is the one that I'm using in the first person I'm going to go to the third person folder the inputs folder here and I'm just going to delete that input folder um it shouldn't have any references because uh yeah it's only the third person character um I'm going to delete that so that I've only got the one input action here because one of the is not being used so um now if I search for get IIA move you'll see under enhanced action values there's only one here this is the action value outputed when you press any of the movement keys I can split that and plug in the X here I can do the same with the mouse I can get mouse X and this will be the one under Mouse values Mouse X plug that in same with mouse y get mouse y Mouse values plug that in nice um now we just need to call that function in our animation blueprint so go to your animation blueprints event graph and instead of uh dragging in more lines we're going to have quite a bit of stuff here so um I'm actually just going to get my character reference here and then off of that uh get hands sway data message like so grab an execution pin plug it in and then I'm going to highlight these two and collapse these to a function just to keep it neat in here and I can call this calculate hand sway open this up and off of the first one uh we're going to get a map range clamped and the in range is going to be Min -1 to 1 and these values here you can play around with and customize um I'm going to make them Min - 5 to 5 um this is basically you know this is basically a multiplier it's going to multiply how much your your hands Sway and move around um off of the return value we can get an f interp 2 but this is not actually going to be the current this is going to be the target so plug that in there um and we're going to need a new variable in here we can call it hway rotation whoops rotation and that's going to be of type Rotator we can get that and split it and um this one is going to be the Y I believe uh Delta time you can uh get Delta seconds and the interp speed I'm going to make five again this is another figure that you can play around with it's going going to be basically how aggressive your hand sway is so these these will be sort of how far your hands will Sway and this will be how fast okay um now that we've got this we can duplicate it two more times and I'm going to plug in these ones here and I'm going to change the bottom one from positive 1 to Nega 1 it's just going to be inverse um then what we can do is U make a rotator actually we don't need to make a rotator we can just set the hands rotation and split the struct bins like so uh we'll also need to change which ones are plugged in here um so this one is going to be Zed and this one's going to be X and then where you want to plug them in here is the um same same ones from here so this one will be y this one will be Z and this one will be X like so nice if we compile and save everything that should be all set up um grab a weapon ah no we just need to sorry we need to add the we need to actually apply this to some bones so we're going to go to the enom graph and this is very important um with the two- bone ik you want this to be before the two- bone ik if you put it after the ik will not um move with the rotation so make sure before two bone ik um what we're going to do is grab what we can do is just duplicate a transform modify bone like this one here because it's got rotation already set up on it just rotation nothing else um if you didn't if you didn't grab these uh transform modify bones what you can just do is search for modify and grab a transform modify bone you'll select it and you'll up here under translation you'll uncheck expose as pin we don't need need translation we do need rotation so you'll leave that one on but you'll change rotation mode to add to existing and scale unexposed that as a pin and Alpha unexposed that as a pin so you've just got this one pin left rotation and the rotation mode is set to add to existing and then you can change the bone to the left hand and since I've set this one up I'm just going to use this one and you can duplicate that and change the other one to the right hand plug these in here oops grab your hand sway rotation plug it in here and now that should be all good to go I'll grab a weapon and I've Got Hand sway up and down bit of rotation side to side which you can see with my animation is quite nice you could blend by uh your is aiming Boolean and change the values for when you're aiming and when you're not aiming you can also um I mean you could do a lot of things you could store uh floats within your weapon class um that multiply the rotation um but as as you can see here it's working quite nicely with the leftand ik which is staying right there on the weapon very good all right let's add some procedural recoil and the first thing we're going to need to do is create a new blueprint interface so go into your interfaces folder right click blueprint blueprint interface and I'm going to call this one ANM BP interface um this one one is going to be added to our animation blueprint to be called from our character blueprint to kind of send data there or call a function over there which is going to be our procedural recoil so I'm going to open this up and I'm going to rename the function interface function underscore recoil and I'm going to add a few inputs here all of type float I'm actually going to add five um now this is going to be um the floats that we pass from our weapon so we can add uh these in our uh weapon master and then change them in each child actor in each weapon to pass through to this function to give our weapons different uh recoil Behavior so the first one I am going to call just recoil multiplier um I'm just going to call it's um multi for short cuz I don't want to type multiplier over and over again I'm going to call the next one side recoil multiplier and I'm going to call the next one Kickback multi kickside multi and kick up multi so these first two are going to be rotation The Recoil is going to be how much the gun Rec uh sort of rotates upwards when it kicks and a little bit of rotation to the side um this is going to be how much it kicks back towards the player this is going to be kicking to the side and kicking up so kicking to the side and kicking up is not going to look super great on for example an assault rifle but with these ones you might want to dial it up for say an Uzi or machine pistol um to give it a kind of you know Wayward uh recoil Behavior so um yeah that's all we need to do in here we can compile and save that and we are going to add this to our animation blueprints class settings over here add the implemented interface n MBP int compile and save that and then in the event graph we can find interfaces over here and double click if recoil um I'm just going to add this in the event graph down here you could collapse this to a function if you wanted to uh make things more organized but I am just going to add um add the logic right here in the event graph the first thing I'm going to do is take all of these inputs and promote them to Local variables so um this is actually going to be a bit of a faf but I'm going to copy the names here and then promote each one to a variable and um oh I can just leave the name as is like that so yeah I'll promote each one to a variable like so plug all of this is in nice now I can get them whenever I like um I will also create a couple of other variables um let's call one recoil rotation that one's going to be a rotator Let's uh create another one called recoil location this one's going to be a vector and this is going going to move our weapon um and we'll also create one that's just called recoil of type transform and I'm also going to duplicate that one and call this one recoil transform also of type transform okay so recoil rotation we are going to set here and we're going to actually set it twice the first one we are going to grab recoil transform and split it and just plug in the rotation here and we are also going to get uh make Rotator and we're going to set recoil rotation off of this make Rotator which is going to be made up of a few um multiplication nodes so we'll get three multiplies and we can plug these in here and I'm also going to get uh random float whoops random float in range so we're going to add some Randomness to our recoil and I'm going to plug these in here and then what I'm going to plug into these other nodes here are what we've brought over so our recoil multiplier recoil multi and our side recoil multi we can plug into these other two you can set this up however you like um you might want to create even more variables to have even more customization for each weapons recoil Behavior but um this is what I've found gives me a a pretty pretty decent amount of control over how each weapon behaves um you can also set these values however you like um or you can try copying what I've done um so this one is how much your weapon recoils up so like rotates up when you fire um again you can change this with the multiplier as well um but so this is these are the numbers that I've found to be um decent I don't want for example my side rotation to be very high as standard so if I just give my um my weapon a side recoil multiplier of one um it won't be too extreme um and then if I want to make the gun more Wayward I can make it two or three times this whatever I want um that's pretty much the recoil rotation set up we can now do a similar setup with the recoil location so we're going to set it twice and I can duplicate this recoil transform here and just plug in the location and then we're also going to do pretty much the same thing with the location just going to move these over here um except this won't be a make Rotator um this will be a vector and obviously these will be different plugins here as well uh we are going to have the kickback uh multiplier is actually this middle one right here um so this we want maybe from minus1 to min-2 depends how much you want the weapon kicking back um you want to make sure it doesn't kick back through the the camera for example and start clipping through the weapon um the kick to the side is this top one here which I might set to like a really small value I really don't want um the weapon kicking to the side very much at all uh 0.1 to 0.1 and then uh the kick up is going to be this last one here and I might make that 0.5 to1 this is something that you might for example dial right up for a Desert Eagle or something some kind of hand Cannon and you wanted to kick up really high as well as kick back a lot and recoil a lot um yeah you can fiddle with these for each weapon and uh once this is all set up here you can just change the values in in your weapon and um and test it and go from there so um now that all of this is set up we are going to set recoil transform and split the struct pin and the location will be the recoil location right here and the rotation will be the recoil rotation right here nice we're almost there uh we also need to set our recoil and our recoil uh transform um on event update animation uh so what I'm going to do is just grab an execution pin to set recoil and recoil transform and for recoil we're going to use uh T interp 2 interpolate transform and the current is going to be recoil and the target is going to be recoil transform Delta time we can get World Delta seconds and the interp speed I'm going to set as 25 we want this to be quite aggressive but this is one of those figures that you can play around with and change yourself if you like uh we are going to duplicate this and use this one here as well except here the current will be our recoil transform and the target will be zero so what you can do is just make a transform and leave these values as zero and I might make the interp speed 15 the very last thing we need to do well actually we need to call uh we need to call this in our character blueprint but the last thing we need to do in our animation blueprint is apply this to some bones so you can go to the anom graph and right here before your two bone ik um what we can do is is we want to apply it to the right hand um so we can duplicate this one which is already have the right hand selected but we do want translation exposed so we can expose translation as a pen and we can change translation mode to add to existing okay and then we can just grab the recoil transform and split it and plug the location into translation and the rotation into rotation but I don't want this to just affect my right hand because I also want for a rifle for example when the rifle butt is into the shoulder I also want the shoulder and the upper body moving a little bit as well with this so what I'm going to do is duplicate this one and I'm going to change the bone to modify to say spine 4 so spine four and everything above it is also going to be um affected by this I can plug in the location and the rotation but I don't really want I don't want it to affect the spine as much as I do the hand especially with regards to translation because the hand can quite easily move its location but if you're moving the spine bones location it can cause some kind of you know undesirable result results um you know the back would start to deform because the spine is actually moving instead of just rotating um so what I might do is just multiply the location by a float and I'm going to make it like 0.4 or something dial it dial it way down um that should be all good there all we need to do now is call this function in our characters blueprint so what we can do is find our firing logic and as part of our firing logic here just going to move this out of the way this event graph is very disorganized um you can comment comment stuff you can collapse stuff to functions if you like to make it more organized um I don't really bother with uh you know when I'm doing this I'm focusing on just the result um so what we're going to do is just um I think we need to get anom instance for the target for this um this um blueprint interface so uh we'll grab our body and get anom instance that's going to be our Target so we can um it was called ANM BP recoil here we go if recoil so we can call that we can call it here and we can duplicate it up here and call it here like so and um let's just set up these these uh values for our assult rifle I'm just going to set them as one um so very very quickly I am going to find my weapons folder and my weapon master and I'm going to add these floats and it's going to be recoil multi and I'm going to duplicate this four times and I do not want to type so uh I'm going to copy them from my BPI right here you know momento por for V which one am I up to I just did that one sorry about that recoil side recoil kick back kick side kick up compile and save and then in my BP assault rifle in its class defaults I have now got these floats over here and I am going to set them as one for now you can change these in each weapon to change its recoil Behavior but that should be absolutely everything if I grab this weapon and fire it's not doing anything why is it not doing anything calling that here ah yeah sorry I forgot to plug these in these are all set to zero that's why there's no recoil CU it's multiplying all of those um calculations to zero um so I just want to grab my current weapon here and uh I'm going to have to get all of these so um get recoil multi and that's going to be these ones this is going to start getting quite messy here um so what I might actually do is collapse this to a function um I might just if I just collapse this to a function and um I'll just call it add recoil and then I should be able to just do the same here add recoil call function plug in that self to as a Target and then in add recoil I will grab my current weapon and recoil multi get recoil multi get side recoil multi get kickback get kick side and get kick up nice there we go sorry about that that should be working now there we go it's got quite a lot of uh kicking up going on here we can also have a look in the ah it ran out of ammo I also haven't got the pose um set up with the rifle butt into the shoulder we're going to do that together in a moment um but just quickly before I run out of ammo I'm going to eject and have a look how it's affecting him it's making him move a little bit uh very good is kicking it's kicking up quite a bit um I probably want it to kick back more than kick up so with these multipliers set to one we can kind of set up a base um a base sort of recoil Behavior Uh it's in the event graph isn't it um kick side kick back kick up 0.5 to one yeah I'm I'm going to I'm going to make this um more like 0.1 to 0.5 these are probably actually quite quite big as well um yeah it's up to you to fiddle with these figures to get it behaving how you like this is still like quite erratic um I might want to tighten this up for an assault rifle um you know and and you can just do this through your assault rifle BP you can change um you know for example you might change all of the side stuff to 0.5 to uh really dial that back and you might take the kick back multiplier a little bit higher um and The Recoil multiplier um you know keep the kick back and the recall high and turn everything else down and then that should work that should change its behavior and it has it's kicking up and it's kicking back but it's not kicking to the side or rotating to the side very much nice really nice all right guys um I want to show you how to do some nice realistic posing with a nice realistic weapon so if you haven't uh if you haven't got it already what you can do is head to the unreal Marketplace and you can find What's called the FPS weapons bundle it's going to be here in my library um FPS weapons bundle so find this one and add it to your project and once that's added to your project you'll find this FP PS weapons bundle folder and the weapon I'm going to use is in weapons meshes ar4 and you'll find this ar4x skeletal mesh now I'm not going to go through the steps of uh creating a new weapon blueprint with this uh skeletal mesh I've already gone through that with you before I'm just going to show you how to pose your character uh using this skeletal mesh um you can go ahead and create a socket and everything and the weapon blueprint and the pickup blueprint and change all the class defaults in the weapon blueprint and the pickup blueprint if you want to actually implement this as a weapon I do think it looks quite nice um but I'm just going to be going through how to pose with the actual skeletal mesh so you will need a socket um I can find my character's body and go to the skeleton and as you can see here here I've already created a socket on the right hand I've just called it ar4x socket um but what we want is an actual pose um so what I'm going to do is in our anim starter pack folder where is it enim starter pack and our ue5 retargeted animations I am going to find idle rifle Iron Sites and I'm going to pause this on the first frame and then up here click create asset create animation from the current pose and in my main and animations I have created a folder called a a4x enm um I'm just going to call this one U 5core ar4x uncore base pose and create that one and this you can see has uh opened up that animation if I hit play this is just a single frame animation so it's just a pose like so uh what I am then going to do is find that folder right here and I'm going to duplicate and retarget this animation using my uh Manny to metahuman ret targeter I'm going to change the folder to that folder ar4x ANM and hit retarget and now if I open this up what I've got is a single frame animation a Basse pose for my metahuman right here now uh we are going to make some changes to this Basse pose but first we're just going to fine-tune the socket a little bit so so if I go back to my skeleton what I can do is change my preview animation to my ar4x base pose like so and then with regards to the socket location all I'm going to worry about is the right hand so I'm going to se select my socket location and start fiddling around with this position I want the index finger to go through the trigger guard and I also want this to rest in the crook of his thumb here and I want the top of the weapon resting over the top of his thumb like so so it doesn't have to be perfect but you do want it resting in his hand in quite a nice comfortable looking realistic way and then what we're going to do after this is play with the fingers a little bit to make it look even better but we just want it resting on the top of his hand like so and into his hand the palm of his hand so it could be a little bit better here I think just bear with me here I think that's pretty good like that um like I said doesn't have to be perfect but this position in here is mainly what we're worried about um I'm just going to whack that back in there to hell with a little bit of clipping through the hand you're not going to see it it's on the inside of his thumb um so yeah that's good right there and that's all we need to do in here we fiddled with the socket now what we're going to do is change this pose a little bit so it's in his hand but obviously his fingers aren't fting my camera speed a little bit his fingers aren't grabbing the grip and this hand is nowhere near the front and even if it was the fingers were not grabbing or anything like that so we're just going to fix this up now um if you can see the whole hierarchy of the skeleton here you just want to click car and bones and change it to selected only and then we're just going to select what we want to change over here in the skeleton tree so uh first thing I'm going to do is find his right hand his lower arm right and his upper arm right and I'm going to change this to Global space right here and I'm going to start making the weapon sort of straight and line up nicely with his shoulder and what I can do is I can also try and minimize this kinking on the wrist here um that's actually pretty good like that except there's a bit of clipping here so um it's it's going to be hard to eliminate all this kinking on the wrist I'll be honest it's about the scale of the weapon um but we do want the butt of the rifle sticking into his shoulder so we're going to put it about there and then what I can do is change the upper arm to make the gun nice and level you can use this plane that he's standing on as a reference to get this nicer level like so that's pretty good um you then want to go on to fiddle with the fingers here and make this look really nice I am not going to go super into detail in front of you here and show you the whole process um I'll just show you sort of what you want to do or give you a couple of tips and hints here um you're going to have to do this yourself anyway and you're going to want to make it look however you want to make it look but when you're playing with the fingers you almost certainly want to change this from the global space to the object space so that you don't uh deform the fingers too much um and you might even want to change the scale of the fingers so let's say I've got his thumb like so on the weapon here and let's say he's got kind of sausage fingers going on with some of his fingers so you might want to play with the scale and if you play with the uh the first thumb joint it's the parent of the second and the third so if I changed this scale it would actually change the scale of the whole thumb um just going to turn scale snapping off um so you can see that changing the scale of his whole thumb maybe you don't want to do that maybe you just want to change the second and the third so you might want to just you know scale down oh that's the length um there's thumb three it's broken down and to yeah oh that's thumb three right there um it's broken down into a lot of other things here I just like to mess with the main ones so you know thumb 1 R thumb 2 R thumb 3 R um and I do think that his fingers are a little bit fat I've kind of made a hash of his thumb there it doesn't look great anymore but once again this is just up to you guys to play with to make it look however you want to make it look um and you'll go through and you'll grab each finger and um metat tassel and make it look really nice so you might start with the the metac carple and you know put this here wrap his hand around the grip and also with the left hand uh one thing you want to note is that the wrist is kind of deformed a little bit from this pose from the mannequin is is not very aligned with his forearm it's not very natural looking so you might want to grab the left hand and just make it look a bit more natural like that and then start to place it under the uh under the weapon here to grab it um so what you want to do is play with the upper arm and the lower arm to get his hand more or less into position and I want his hand to be sitting a bit bit further forward on the weapon than this so I might Point his upper arm a bit more in and forward and then use the lower arm to get the position and I might change this to Global space right here just to make things a little bit easier and I'll put his hand into position like so that looks pretty good and then I'll start wrapping his fingers around so um you know I might start with the thumb and obviously we want this last joint to be um it's hard for me to tell which ones oh I've still sorry I've still got this on global space which I said you don't want to do with fingers you want to change this to object space that's why I was having a bit of trouble there working out which way to rotate it might do it like that and then you'll fiddle with his hand wrap all his fingers around the weapon so it looks nice and grippy and that would pretty much be it um if I switch over to my other project now where I've already set this up I'll sort of show you what the end result looks like but um basically you want to take this pose and you want to put it into your animation blueprint uh in the atom graph you'll go into whatever weapon you're adding so if you've added the ar4x as a new weapon you might uh add add a new PIN how do we add a new PIN add blend pin uh you know add ar4x to U weapon in three and then you would just go into to wherever you have it uh we are going to do procedural aiming by the way uh it's what I'm going to add uh next but but yeah so you would you would change your assault rifle Idol or your ar4x idle to this base pose that we've just created um just before we finish up guys I want to show you one last thing which is going to end all of your pitch and spine rotation woses I'm sorry that we put so much work into the spine rotation for me to just change things now but I have discovered a much much better way to set it up so what we're going to do instead of setting our pitch on our spine bones uh from all of the mouse input here we still are going to do our aiming Dead Zone off of our Mouse but here where we are not aiming for example and we're just setting the pitch uh we do not need need any of this functionality that just sets the pitch we can do it all in our animation blueprint by going to the event graph and what we can do instead of setting pitch off of Pitch here I am just going to move this out here so you can uh See Clearly what we're doing all we actually need to do is get our character reference get controller rotation split the struct pin and then we're going to use the Y here on the control rotation the first thing we're going to do is minus the Y off of 360 so 360 minus the Y the next thing we're going to do is multiply this by -1 and the last thing we're going to do is check if it's greater than 180 and then I'm going to use this to select float plug this into a and into B and then I'm going to divide this by the number of spine bones that I'm rotating which for me is five and plug that in so as you can see now we're setting pitch off of just these calculations right here and if I hit play the hands are following the camera just as they were before this is a much much less hacky way of making this work uh this is now tied to our camera rotation instead of doing all these calculations on the mouse input um so this is yeah this is a much much better way of making this work all righty guys I'm just going to switch to my other project and show you what these um poses look like uh on the ar4x all righty so as you can see here I've got my ar4x set up as a full blueprint it has leftand ik it has uh weapon Sway and procedural recoil and I'm just going to turn the volume down here and if I hit f8 to eject you'll see that this pose looks quite good quite natural rifle butt is in against the shoulder The Recoil is a affecting his upper body as well so he's got a bit of jerking here so if you were to replicate this and you were to look at this character is now pretty much a fully-fledged true uh true firstperson character with a full character model weapon recoil hand sway bullet casings ammo we're getting very close to completion here guys I think what we've made is really really quite nice uh I am going to go on to show you procedural aiming down the SES as well um but that's it for today guys I'm very very excited with what we've done here I'm very excited to bring you this stuff and add a bit more realism and professionalism to our true firstperson shooter project if this video has been of any use or value to you whatsoever please hit like And subscribe and I will see you on the next one
Info
Channel: MizzoFrizzo
Views: 4,552
Rating: undefined out of 5
Keywords: TFPS, animation, blueprint, fps tutorial, how to add a gun, how to make a fps game, realistic, shooter, shooting game, true first person, tute, tutorial, ue5, ue5 first person shooter, ue5 fps, ue5 fps tutorial, ue5 weapon system, unreal engine 5, unreal engine 5 fps tutorial, unreal engine 5 tutorial, unreal engine 5 weapon system, unreal engine 5.2 first person shooter tutorial, unreal engine fps tutorial, unreal engine gun system, unreal engine tutorial, video game development
Id: hNL3ELCMn80
Channel Id: undefined
Length: 61min 25sec (3685 seconds)
Published: Tue Jan 02 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.