PressedJump variables

Recently i found variable bPressedJump in the code which change value to TRUE when we call function ACharacter::Jump() and at the next frame our character is start jumping.

void ACharacter::Jump()
{
	bPressedJump = true;
	JumpKeyHoldTime = 0.0f;
}

In ThirdPerson template i made small script for testing:

and do not see “Hello” when character is jumping.
May be this is different variables(BP and C++)?

P.S. I want to use this variable to skip start jumping state(animation) in AnimBP, when character just fell down. If this right way then dont need use additional variables and changing their value when ActionInput pressed/released.

Are you sure youre calling the right version of the Jump function? It says there that is the Targeting Character as Epic has their own Jump function which possibly might not set that variable (though it should).

I’m sure. Breakpoint in code(in MVC) stops program when i press SPACE for jump. And bPressedJump change value on TRUE. In BP description of the PressedJump says this:

http://i.imgur.com/oBU0024.png

Okay I thought you might have implemented your own Jump function.

I just did a test then replicating exactly what you did in my own project and it shows hello.

I just did a test then replicating exactly what you did in my own project and it shows hello.
Magic))) You use 4.14?

Yup 4.14.3 are you sure you have the right Character class set for the gamemode?

I create new project, replicate script, and event tick do not print Hello. But if i made this

http://i.imgur.com/wvBrDPQ.png

result is:

http://i.imgur.com/4r8ILos.png

Okay so I mulled this over, your Print String for tick has a duration of 0.0. Best answer I got :slight_smile:

Fixed it, but still nothing(

I know thid thread is quite old, but I recently had the same problem, the solution is to check bWasJumping instead.
It seems that if JumpMaxHoldTime is set to 0, bPressedJump is cleared within a single Tick in C++, and the BP probably never sees it.

bWasJumping is set and hold if the Character actually jumped and was still jumping in the previous frame. Unreal checks if the Character is even able to jump before jumping etc.

Hopefully this solves it.

Cheers

1 Like