How do I find if my kinematic player has negative Y velocity? (I.E Falling)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Bobigondo

I’m trying to improve my fall height detection by getting the height from the peak of a jump.
It currently notes the difference between the translation.y at the start of the jump and at the end, which works fine mostly but isn’t accurate to the actual distance fallen.

How would I find when a kinematic body is losing height, so I can note that as the starting fall height?
I tried the below if statement as a shot in the dark, but obviously the -velocity.y part isn’t going to work.

if -velocity.y and !has_contact and !is_falling: 
	is_falling = true
	fall_start = translation.y

Thanks.

:bust_in_silhouette: Reply From: kidscancode

To tell if a value is negative (less than 0):

if velocity.y < 0:
    is_falling = true

However, that’s not going to work, because negative velocity indicates upward movement. You’re falling if velocity.y > 0.