How to make my character fly by hitting the jump button twice?

Hey guys!
For a game project I’m actually developing on, I have a flying-type character I’d like to fly like a jetpack by pressing the Jump button in mid-air. Unfortunately, I’m just a mere beginner on UE4, so even though I tried my best, I wasn’t able to perform what I wanted. Could you please help me?

Have a nice weekend

Did you try something like:

Space bar → branch if counter = 1 false → counter+1 → jump → timer (for example 1 sec) → counter=0

if counter = 1 true → activate fly → counter = 0

when you say fly like a jetpack what do you mean? do mean forward like the jetpack in rocketman (think airplane) or just a thruster upward?

Id starts be having a branch from your spacebar input. have the bool from the branch connect to a IsFalling? node to see if the player is in the air. if they are falling add a force or something if they arent then just do a jump.

Hope That helps get you started.

Thanks Nickcha, but I’ve tried to do it this way before, but it didn’t work out.

oh and, Thompson, When I say flying character, it’s indeed like in Rocketman with the character flying, bound to the cursor, and not just a thruster upwards. Although I want my character to return to walking mode by pressing the jump button again while flying or get close enough to the ground, but I tried pretty much the same thing you did and it doesn’t work as expected

how about when pressing the jump button while in air you activate a floating pawn movement and disable character movement. then do the reverse when you want to land.

i just tested that method on a basic level and got it working though i did add a new axis mapping for gaining/decreasing altitude.

in the below picture pressing Spacebar on ground jumps, while in the air activates flight, pressing while flying resets to normal movement (character falls to ground). i used the axis mapping to control ascent / descent via the x and c keys.

Hey, I work with Nesmanstudio here for our project, so don’t worry if you see me pop in every now and then.

I tried to do as you suggested, though I wasn’t able to find the Get Floating Character Movement you use here. Also, the way I imagined the blueprint was that no button should be used to get higher or downer, but acting like your character flew like Superman, being free of movement and fly while following the cursor, so if your camera goes up, you fly higher, and vice versa, along with turning when the camera goes on the sides. A bit like this tutorial, in fact: Unreal Engine 4 Tutorial - Flying Movement Mode (Jetpack) - YouTube

the floating movement is a component you have to add in the component section at the top left. i just used the the input for up and down as an example and to so i could easily test the main system. you could easily have a constant forward movement that would go in the direction you are looking. oh and in that tutorial he uses input to control altitude.

you can get a constant forward movement by doing whats shown in the picture below. then you just need to script a way to rotate your character. the rotation of the character will determine the direction it goes in this case since it is always moving forward.

Hi ThompsonN13 … Can you teach me how to make my character fly where the camera looks? :smiley: