My 2d character is jumping only once 4-27

I am doing a local multiplayer 2d game. I applied character jumping before using this tutorial series: UE4 - Tutorial - Local Multiplayer Pt 1 - Project Setup - UE4 / Unreal Engine 4 - YouTube
to make it multiplayer. It was working fine until now. Now, my character is jumping only the first time i’m pressing the key, then it stops working. Everything is set up fine and i have no idea what’s wrong.
image

Okay, so i know what’s wrong but have no idea how to fix it. It turned out that my character after this jump is on IsFalling state, so it’s not possible to call the jump function. Does anyone know how to fix that?

It depends on how your character is setup.
But in general there is something that checks to see whether the character is in the air or not.
So how does your character go into the IsFalling state? Is there a linetrace pointing down from the player to check if there is ground under it?
Generally something like a linetrace going down from player → check if hit-> boolean (yes or no)->branch Set Isfalling from true or false out of branch.

Hi!
I meant this node:
image
probably I made a mistake calling it a state, I’m new to unreal and don’t know a lot yet. I’m also not sure if that’s the reason why it’s not working, but i think it is, because the first time it’s false before jumping and the second time it’s true and jumping is not working.

Ah from character movement.
Im not sure how your bp is setup so its hard to see what might be the problem.
There is propably a check from the “Jump” that checks if IsFalling is true?
I generally create my own booleans for things like that so im not sure how IsFalling checks to see whether it is in the air or not.
Maybe add something like this and check what the print string says when you are in the air.
It should show true when in the air and false when on the ground every second.

It’s showing true all the time.
Screenshot_1

In the spirit of helping you a little bit :slight_smile:
You could create a linetrace to shoot down to check if you are grounded.
When linetrace hits the ground within the length of the trace then IsGrounded = true.
Then from your jump press just use a branch to check whether you are grounded or not. Hopefully this gives you some insight.

I copied your code and IsGrounded was false also, so probably the player does not see my tile map, do you know how to fix that?

This is very strange, Your player collides and has contact with the ground?
This linetrace is simply blocked by visible geometry, so it should work.
Could you just place a square block under the player and see if is grounded works then?

After reloading editor it worked, so it was probably a bug. Thank you for help, unfortunately, my charcter still cannot jump. I have a question. Do you know how to make custom jump function (i mean the function that doesn’t use Jump from Character Movement component)?

Good that it worked.
Custom jump, depending on what kind of game your making i guess.
If you want it to be fully physics based you could look at something like physics impulse
for an instant applied amount. or physics force for a more over time controlled force.
and then lock your rotational axis so you stay upright.
But seeing as you are very new to the engine i would suggest trying some of the tutorial series on the “Learn” tab of the engine. There are multiple projects to give you a decent base on how to tackle certain situations. The most recent stack-o-bot project is in ue5 so it can give you some more up to date information for reference. And documentation is your friend :slight_smile: It needs a big update for ue5, but most things still apply.

Thank you for your help!

1 Like