How To Crouch | Unreal Engine 5 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so to get started the first thing you want to do is go to your third person folder or your character folder and go to your inputs or wherever you store your inputs and go to the actions right click and go to input and add a input action and call this I aore crouch we don't have to make any changes inside of this input so you can simply hit file and save all to make sure it's saved this input action if you're unfamiliar is how we actually tell Unreal Engine and more or less our game or whatever project you're working on what button you're clicking all right so next we can go back up to our input folder out here and open up the IMC default all right so inside the IMC default you want to come over here to your mapping right here as you can see we have other input actions in here and you just want to click this plus and in this drop down where it says None right here click this and search for your input action Crouch we created and right here we select our key we want to use you can do the drop down and search for all kinds of different stuff but for the sake of the sake of the tutorial I'm just going to hit this little keyboard right here and press control and it'll automatically find the key you press you can add multiple Keys as well so if I click the plus again I could add another key if I wanted to but I'm just going to leave it on left control for now we don't need to add any triggers or anything to this and we can simply just save and close the IMC default so now you want to navigate to your third person character or whatever character you are using once it's opened there is one key thing we have to do and that is inside the character movement component right here you want to click this and then come over to its details and search for Crouch as you see different Crouch settings pop up the one you want to worry about is the can Crouch right here make sure this is true because this is what allows the character movement component to accept Crouch inputs as you can see there's also Crouch half height and this is basically the height of the capsule component whenever you actually Crouch this value is customizable I'm just going to leave it at the default 40 but you could play around with it and set it to 50 or whatever you prefer to get it looking right to you same thing applies to the max walk speed while crouched right here as well all right so next you just want to find an empty space in your event graph and right click and search for I aore crouch that we created earlier off of Started you want to drag off of this and search for Crouch and this Crouch right here is the function I was talking about that we made available in the character movement component right here next off of completed I'm going to drag off of this and do uncrouch just like that and so now this is basically the setup of the Crouch system and so now if I compile and save my character minimize this and play it in the viewport as you can see whenever I hold down control my character walks slower and the camera moves down a little bit but you may notice there's no animations and we are going to add those right now all right so in my content folder as you can see I have map animations right here these are from the unreal Marketplace I will leave a link they're completely free I'll leave a link to them in the description below where you can check them out and download them if you want to or you could use your own custom animations once you have map downloaded the animation we're going to be using is in the animation folder Mobility Pro in place and it's the Crouch walk right here but as you can see if I open it up this is Manny from Unreal Engine 4 and it's not the Unreal Engine 5 character to fix this all you want to do is close the animation go over here in your content browser to it right click and go to retarget animation asset and select duplicate and retarget animation asset right here over here on the ik retarget you on the none you want to click this drop down and you want to select ue4 Manny to ue5 Manu right here if you have ue4 on the left and ue5 on the right then you should be good to go and you can simply hit retarget this should make a new Crouch animation right here in your content browser we can open it up and as you can see it's the Unreal Engine 5 Manny all right so this is where the tutorial s it gets more complicated with animations but just go to your character folder right here mannequins animations Manny or my bad my bad not not in the Manny folder but right here this ABP Manny right here open this up and when you open this up it looks sort of like regular blueprints except there's an animation thing over here and essentially what we have to do in here is tell the animation when our character is actually crouching which is pretty simple to do as you can see Unreal Engine already has references set up to your character so all we have to do is come down here copy this movement component right here contrl + C contrl V to paste it and all we have to do out of this movement component right here is search for is crouching like that just like is falling right here and then off of this is crouching this Boolean right click it and do promotees variable and call this is crouching just like that and so now up here on our sequence we want to plug it into our animation updator and so you just want to click this little add pin to the sequence right here drag off of pin number three drag all the way down here and simply plug it right into there to add a reroute node to move it out of the way you can just double click the line and sort of just drag it down like this doesn't have to be perfect but something like that just to get the line out of the way and so now inside this animation blueprint it is now knowledgeable of if the player is crouching or not all right so now that you have everything hooked up make sure you just do a compile and save to make sure everything is working so far and you're not getting any errors so now from this event graph we can head over here to The Locomotion machine right here this again will look a little complicated if you haven't seen this before but essentially what we have to do is just set up the logic for the controlling of the animation itself all we have to do is worry about this Locomotion State machine right here so just open this up and as you can see inside here you have idle and walk and run these are your two animations that unroll engine comes with what we're going to do is right click and search for add state right here in this list and we are simply going to name this Crouch like that and it's real easy to forget this because if you don't do this then your character will T pose so we're going to open it up right now and over here in your search Assets in the asset browser you want to search for Crouch and your map Crouch walk should pop up right here drag this out and then just connect this right into the result of that on this animation right here as well over here in its details you want to search for Loop animation right here this is very important or your animation will just play once and it'll end so now we can compile and save head back to The Locomotion graph right here and as you can see the idle and the walk run have transition rule set up which allow actual transitions to that animation so what we're going to do is transition to crouch as well on the idle right here we're going to going to drag Up drag off the edge of it it might be a little hard to grab it but if you drag off the edge of it you should get an arrow like this drag it onto the Crouch drag one back off of the walk run do the same thing drag one to crouch drag one back and now your transition rules have to be set up proper if you want this to work properly so do this step exactly how I'm showing from your idle to crouch this little line that goes from idle to crouch double click that inside here you want to drag out your is crouching bullion and you want to Simply get is crouching and connect that in right there up here at the top click Locomotion to go back out and as you can see if we hover over our transition right here it says is crouching right there so now from Crouch to idle what you want to do is go into this by double clicking drag is crouching in get is crouching drag off of this Boolean and do not Boolean search for that and drag this not Boolean into the result once again go back to Locomotion and you want to do the exact same thing for walk run so on the pin that goes to crouch you want to open this up dragon is crouching go back to Locomotion Crouch to walk run open this up dragon is crouching and and then do is not or not Boolean right here connect this up and as you can see if we go back out to locom motion all these pins should be hooked up all right so I actually forgot one thing what we have to do I completely forgot the step but essentially we need two animations in here and so what we have to do is minimize and in here is inside your Crouch state right here so minimize your animation right here go back go back to your mocat Basics open it up animation Mobility Pro in place and you want to grab this Crouch idle right here so like just like before right click retarget animation asset duplicate over here on the retargeter select ue4 manny to ue5 manny retarget just like that and we can open our animation back up like this over here in the search asset search for crouch crouch idle right here and so what we are going to do is blend between these two animations whether or not our character should move right here this bulling that Unreal Engine has already set up for you and all you have to do is drag off of your Crouch walk right here and do blend bull or blend poses by Boolean right here and the true pose is going to be your Crouch walk and the false pose is going to be your Crouch idle and the active value is going to be your should move and so now if we compile and save then it should be working and so now if I test it out as you can see I can run around Norm and if I crouch I sit idle crouching and if I start walking the character starts Crouch walking I can stand back up like normal I can Crouch again I can sit still idle and yeah anyways that's a super basic Crouch system obviously you can get way better animations and you can get a lot more sophisticated inside the animation blueprint but just has something to get you going as like a basic Crouch system it's definitely not the worst in the world but yeah if you enjoyed or found this video useful then leave a like subscribe for more and I will see you in the next one bye-bye
Info
Channel: The Average Dev
Views: 2,120
Rating: undefined out of 5
Keywords: ue5, unreal engine, unreal engine five, unreal engine five tutorial, ue5 tutorial, how to crouch in unreal engine, ue5 how to crouch, unreal engine five how to crouch, how to crouch in unreal engine five, how to crouch unreal engine five tutorial, how to crouch unreal engine 5 tutorial, ue4 how to crouch, crouch tutorial, unreal engine crouching tutorial, how to crouch with animations in unreal engine, ue5 how to add animations, ue5 crouch animation
Id: Y8dZJtIvris
Channel Id: undefined
Length: 13min 13sec (793 seconds)
Published: Sat May 11 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.