How To Fly In Unreal Engine 5 | Part 1/2 (Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to another Unreal Engine 5 tutorial so in today's video what we're going to be going over is how to create some basic flying controls and Mechanics for your game so if I were to hit play I can show you what we're going to make today so as you can see I'm running around walking perfectly normally but if I were to double tap space or whatever button you want you can see we're now flying now I'm going up because I'm holding space if I want to hold Ctrl we go down space up and I can move around like normal as well so we're flying like this and this is very easy to customize so the moment you can see this is kind of slow kind of floaty but we can obviously change that as well if we want to and if I double tap space I'm going to come out of fly mode again and you can again change what buttons do what so it doesn't have to be like that and also you notice I don't have any animations I'm just using the normal ones here I'm going to be making a second part to this tutorial where I will be adding in animations for us to be using so we're not just running on thin air like this so this is what we're going over and creating today so without further Ado let me delete this code and I'll show you how I've done it so the first thing we're going to want to do is we want to create a new input action to be able to control our fly mechanics now if you're using 5.0 or under you'll want to do it the normal way of edit project settings input but if you're using Fiber One or Beyond you're going to want to create a new input action the new way so for me I'm going to go to content third person input actions and I'm going to right click IA move and then just duplicate that naming it IA input action up down as that's what it's going to be for me and I'll open that up straight away now in here we're not going to actually change anything so just make sure it looks like this then we'll save close that and now we're going to open up our IMC or input mapping context and this is just a default for me but the one you are using for your game and here I'm going to add a mapping and we're going to add in our new one so I a up down and we're going to add in two bindings onto this one the first binding is going to be space so going up whenever you want that to be for you and the second one is going to be left control so going down again whatever you want that to be for you but these two make the most sense for me but you could use shift and control or Z and X whatever you want to use use those and then all we're going to do is on the left control or the one going down we want to add on a modifier and this modifier wants to be a negate so we're going to get that like so save that and we can close this as that is also all we need to do to add in our inputs that will now be working perfectly for us so now we want to open up our player character blueprint so for me it's content third person blueprints BP third person character now in here there's not a lot we need to change is actually very very simple so what we're going to do is find some empty space right click get IA underscore up down or whatever you named your new input action we just created off of triggered of this what we're going to do is we want to just make sure the player can fly up the same way we're doing here for going left right and forward backwards so what we're going to do is firstly we want to only do this when the player is flying so we're going to right click and get is flying or just is flying sorry so we're going to get is flying from the character movement component like so and we're going to hold down B left click to put this into a branch going into triggered of our input action so again this is only going to work if the player is flying then off of true we're going to Simply do add movement inputs the world Direction doesn't need to change so we can just put this as one on the Zed now if you want this to be quicker you can increase this but for me I think one is going to be fine and the scale value of this we want to right click action value split structure pin and then put action value X into the scale value there and that will work perfectly fine for what we want to do for our controls surfing compile save this we can hit play and test this out so obviously if I were to hold space we're going to jump for the whole control nothing's going to happen so we're not flying up or down because we're not flying if I were to press the Tilt key to open up the console command let me just move this here like so and then just put fly that's going to enable the constant fly and you can see if I hold Ctrl hold space sorry we're going up if I hold Ctrl we're going down so we have this working perfectly like so but now we want to actually make it so we can go into fly and walk without having to do the console command so this is very simple again what I'm going to do is do it based upon if you double tap the jump button so let me just also comment this flying controls and then let's go down to where our jump is down here what I'm going to do is just make this comment a little bit bigger and move these nodes down and out a little bit to give us some space then we want to create a new variable naming this jump count so we can see how many times the player has pressed the space button and we want to set this to be an integer we're going to get this and then we're going to get an increment into here so that's just going to add one every time this is fired off and this wants to go into started instead of triggered so it's only going to fire off once every time we press the button out of this we're going to get an equal equal and we're going to equal this to 2 or whatever you want so I'm sitting it to two because I want to double tap the button but you can set it to three to triple tap or four to quadruple tap whatever it is you want set it to that number however I wouldn't set it to one because obviously that will be every time you jump you're going to be going to fly mode which obviously isn't what we want here unless of course you have this for a different button but then you don't need to do any of this you can just do it normally from triggered but again I'm not going to get into that right now I'm doing this method here then we're going to hold down B left click to get a branch with that being the condition false we want to jump so if we have not double tapped we want to just jump like normal I'm going to move that down a little bit and if we haven't double tapped we're also going to go into a re-triggerable delay setting this to 0.5 and then after this we're going to set jump count to zero so if the player presses space Waits a little bit longer presses space again it isn't going to work but if they press space then press it again quickly it is because this won't have fired off yet so a reader will delay is a delay that can restart every time it is triggered off of true if this Branch means we do want to go into fly so we're going to go into a flip-flop because this is also going to toggle on and off so flying and walking so a is going to be flying B is going to be walking so we're going to drag out of a and set movement mode and that'll get the character movement for us as well which I'm just going to put underneath like so movement mode is going to be flying not falling sorry the new mode is flying and then we'll duplicate that going into B with the New Movement mode this time being walking so we can go back and forth between the two and then I'm just going to move these out a little bit to make them a bit more organized and looking nicer for us and I'll also expand the comment to be doing the same thing as well and that is all we need to do to be able to enable and disable flying as well as have the movement controls for it as well and again in the next video I will be going over animating this too compile save and hit play to test this out so if I press space we're going to jump for press space again we didn't fly if I double tap it so quickly we're going to start flying space goes up control goes down and wasd still moves the same so we're still walking around like this but we're obviously flying now as well like so and then if I were to double tap space we're going to exit fly mode perfectly like so as you can see here now if we go back into our character blueprint and select the character movement and then search for flying you can see or such a fly you can see we can change the Max Fly speed the braking deceleration so that is the kind of floatiness of it and also can fly so we should take can fly there not sure why it is working without that ticked but there you go so now we can also change the deceleration of flying so if I were to set that to 600 instead of zero this should be a lot less floaty for us as you can see here still slightly floaty but not as bad as you can see we have a lot more control over it and you can obviously just increase this as much as you want so we set it to 5000 as an extreme example it's just going to stop immediately like so and this might be what you want this might be how you want to have it if it is then perfect that's what you have so you have a lot more control now over where we are going as you can see perfectly here and what I'm also going to do is just increase the movement speed of this as well so let's say three thousand hit play and we'll test this out one final time you can see here we now have our controls for flying around like this so I think that'll be it for this video as we've done everything we want to do what we've done is we've created flying so we can start and stop Flying using the same button and as double tapping space and this will also allow us to hold space to go up control to go down w a s d to go forward backwards left and right so we have the perfect controls for flying as we see here so thanks so much for watching this video I hope you enjoyed it and I hope you found it helpful and if you did please do make sure to like And subscribe down below so thanks so much for watching and I'll see you in the next one [Music]
Info
Channel: Matt Aspland
Views: 13,616
Rating: undefined out of 5
Keywords: ue4, unreal engine 4, unreal engine, tutorial, ue4 tutorial, unreal engine 4 tutorial, how to make a game, how to, blender, unity, games design, ue5, unreal engine 5, unreal engine 5 tutorial, ue5 tutorial, flying, fly, ue5 flying, how to fly, minecraft, creative, mode, walking, movement, ue5 how to fly, up, down, input, enhanced
Id: F8HNzXAdcGc
Channel Id: undefined
Length: 9min 20sec (560 seconds)
Published: Mon Jun 05 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.