Character flys off into space when holding the "space bar" to jump

So when my character jumps it jumps fine as long as I let go of the “space bar”, but if I hold it down, the character flys off into space and jumps for infinity lol. I have my locomotion then connected it to my JUMP state (1 jump state) that has is failing boolean set to true and then to false only. I notice some people have a bunch of jumping states? Or do I need some other conditions not just isFalling? I can show you my set up if needed? thanks


locomotionToJump
NewStateMachine

Are you triggering the jump on space bar pressed or released? Maybe that has an impact?

Do you use InJump bool?
When you start jump you need to transition your character to InJump state to avoid all further jumps until Character lands.

Is your characters capsule and camera moving up into the air with your character mesh? Or is the character mesh leaving the capsule and camera?

Usually you are not able to activate a jump with the default unreal engine jump while in the air, which leads me to believe you might be using a jump animation with root motion that takes longer than the actual jump. This would cause you to be able to jump again before the animation is finished playing, restarting the animation and gaining more height. Either that or you have a custom jump function that allows you to jump while isFalling is true

So I may need something in my “ThirdPersonCharacter” blueprint such as a bool and “branch” that says basically if in jump state don’t continue jumping? I maybe missed that part of the tutorial lol I’ll try that thanks!

This is the simpliest thing I can think of :slight_smile:

So this is weird, even when I created a brand new project in UE5 Third Person Character one, it does the same thing, keeps jumping over and over when you hold space bar, I guess that is expected? lol I won’t worry about it then.

I don’t understand why a new third person template would be doing that effect. I would try a few things.

  1. A different keyboard, I have seen faulty keyboards and joysticks do some weird things.

2.Do a verify on your UE5 install using the Epic launcher, to make sure your engine has not become damaged or corrupted.

But…you sound like you have decided to live with it…so try this

Make a boolean variable called “StopJump?” Out the exec from your jump input action…go to a sequence node…I think the sequence node defaults with 2 pins, out of the top send to your jump logic or function as usual. In the bottom pin, go to a delay node…set that to around 1.5 seconds or when you want the jump to end and UE gravity to do its thing…now hold left and drag in that variable to SET it. Tick the box inside and hook the delay to it. Now in that first line from the sequence where I said to run it as usual, we need to branch that, so hold B and left click and make a branch. Hook that between the first pin of the sequence and the branch. Now hold left control and drag in that variable and drop to GET it. Hook the get to the branch. Connect the false output of the branch to your jump logic or function as usual. Right click in an empty place and search for “Event on landed” Again hold left alt and drag in and SET the variable and connect it to the event on landed. Do not tick that variable.

So now when you jump, after 1.5 seconds, that branch is going to go true because we are setting the variable with the delay. And it will not go false again until you land again…now based on your problem / situation and what you have told here. It is likely your character will jump again once landing, lol, …I’m on a laptop right now with no UE4 or 5 or would maybe lay some nodes out and have a screen shot or two.

Thanks! I don’t think my keyboard or engine is corrupted, but I’ll check it out. I can try what you said with the DELAY, and if you have time could you lay out some nodes, with the screenshot or 2? thanks so much! Yeah not sure why why I hold down space bar it keeps jumping lol I’ll look into it more too. thanks again.

1 Like

I will, and will try to recreate that effect on my end.

Have you tried another pc with UE 4 or 5?

This is probably overkill lol, but you could try this in your third person template.

See if this can fix your problem. If not, disconnect the true side of the branch and leave it empty, compile, and try again.

Thanks! Will try what you provided and let you know! I haven’t tried another PC with UE4 or UE5 but that’s a good idea too, I’ll give it a try! thanks

Hi @usa423 so when I tried you code it doesn’t seem to fix it. Tried it with disconnecting the TRUE side of the branch as well. No matter what my character JUMPS the first time, then after you hold space bar it keeps “bouncing” over and over. Doesn’t really fly off into space but some weird boucing movement. Not sure what to try next…

So I finally fixed the issue, you won’t believe how easy it was, I took the Third Person Blueprint and removed the “Jump” function and readded it back in, now the character Jumps once and doesn’t keep bouncing. I guess my “jump function” was corrupted or something. thanks all.

2 Likes

Strange, but I’m glad you got it working!

Thanks for your help, seemed like a weird fix but hey it’s working!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.