Character Movement in UE5 - Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone and welcome to this Unreal Engine 5 tutorial now in this tutorial I'm going to be showing you how to build a super simple first person character movement system which can be used as a perfect base for any of your projects once you open Unreal Engine 5 create a new games link project and you can call us whatever you want I'm just going to call this character movement tutorial so now let's go to file new level basic and create and save this under map General and we're just going to use this as our testing level so once we've done that we can go to folder and create a blueprints folder and inside the blueprints folder we're going to create two blueprints the first one is the BP underscore FPS character and the second one is the game mode we can open up the game mode and set the default Pawn class to the character that we just created now this will allow us to possess this character through the player start um obviously if we have the game mode selected inside of our level so now that our level is using this game mode when we Press Play We Are possessing this character okay so now before we jump into the character go to input and we're going to create an action mapping and this one's going to be called jump and we can set it to the space bar now we're going to create four axis mapping so just click this four times and the first one is going to be called move forward then the next one is move right and we have turn and then we have look up okay so now for move forward and move right we're going to need two keys and under move forward we can set the first one to W and the second one to s and make sure that the scale for S is set to negative one and then for move right we can have d and a and make sure that the scale for a is set to negative one okay so for turn we're going to use the mouse X and then for look up we're going to use a mouse y and make sure that the scale for Mouse wise that's a negative one this just prevents the camera from being inverted um through the add pitch input under the character class once we're inside of our character we can add two components the first one is the spring arm component and the second one is the camera component there we go now for the spring arm component set the Z position to 55 the target arm length to zero and check use Pawn control rotation and once we've done that we can now move into the graph so to begin we're going to start by adding all the camera functionality so we have two axis values that take in Mouse input that is input access turn and input axis look up now with these two we're going to add yaw input for the turn axis event and then for lookup we're going to add pitch input there we go and just for my sake I'm going to change the F of e to 120 just so we can see a bit more um but as you can see now we can move our camera left and right and up and down but we don't have any movement input yet so let's add that now first just comment this um and now we can move on so we're going to start with move forward here and move right so these two are regarding our movement and we need to take data from the capsule component now for the move forward input we're going to add movement input and as you can see here we need a world Direction now the world direction we're going to use is the same Vector as this Arrow for a move forward so we're going to get the forward vector and plug this into World Direction and then plug in the axis value to the scale value so now that's our move forward now in order to do the move right we have to get the right vector of the capsule component and once again plug in the axis value to the scale value and now we have our movement now there's one last thing to do which is the jump and since we're in the character class we already have a built-in jump function that Unreal Engine has created for us so then we can just comment that there and everything is all set up so as you can see we can move forward back right and left and look around in every direction and you can also jump now in order to tweak the values of your character movement there's the character movement component uh once again this is built in and they provided you with all these variables that you can change I'll tell you what you can mainly focus on the max walk speed is definitely one that you want to tweak to your game so if you want the character to look slower or faster just change that value the jump velocity here uh it's under character movement jumping slash falling so if you want a player to jump higher just set this to a higher value or lower if you don't want them to jump as high there's also the air control now if you set this to one a higher value will mean that you have more control while you're in the air and um the max step height let me show you what this does real quick so if I place a box on the ground and I zero its location okay here we go so if I place a box right here the max step pipe basically determines if you can step on it or not but if you see if I can change this to if I move the cube up higher than 45 it's going to be off the ground you can see that I can no longer step on it but if I change the value to let's say 150 as the max step height then you can see that I can step over this box so yeah that's pretty much like the most basic character movement uh system that you can make in Unreal Engine it's a really good starting point especially if you want to build a more complex movement system there's still things to add like sprinting and crouching and a whole bunch of different things but um yeah I mean if you enjoyed feel free to like and stay tuned for the next videos because I have a bunch come up in the near future so
Info
Channel: PolyStylized
Views: 38,061
Rating: undefined out of 5
Keywords:
Id: 1OjlKUQtC1k
Channel Id: undefined
Length: 7min 30sec (450 seconds)
Published: Wed Sep 14 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.