The highest point Jump in CharacterControl

How to check if we reach the highest point when jumping using CharacterControl?
if(reachHighestPoint){you can do something;}

1 Like

I think you could do it a few ways.

First thing I’d try is getting the current vertical velocity of the BCC, and then you can determine that the player is at the height of their jump when vertical velocity crosses from a positive value to a negative value (and if the player has recently jumped and is still in the air to ensure no false positives)

And if there is not an easy way to get vertical velocity from the BCC class (haven’t used it in a while but I recall many protected methods…), you could also also compare the location of the CharacterControl to its location during the previous frame, and use that to determine if the player is still accelerating up or has started to accelerate back down, which would also indicate that they had just reached the highest point of the jump.

Thank you
That means there no easy solution for CharacterControl
So I have to store highest Point
highestPoint = playerControl.getPhysicsLocation().y;
then compere it
highestPoint>playerControl.getPhysicsLocation().y
then fire up the desired method

Another approach would be to invoke getLinearVelocity() after each physics tick and test whether the vertical component is negative.

And how to access this methos for CharacterControl object?

1 Like

In MInie:

    float vy = characterControl.getCharacter().getLinearVelocity(null).y;
1 Like

Thanks
I switched to Minie and found it, it is not exist in jme-bullet

1 Like

You won’t regret switching.

6 Likes