Check if rigidbody is falling

Hey, Im trying to get my rigidbody to stop its code when it is falling, so i tried an if rigidbody.velocity.y is != to 0, this did work in checking if the player is falling or not, but then my other code could kick in. In the code it used rigidbody velocity to move left and right, NOT up and down, but this still trips the if velocity.y statement. how do I get around this?

I dont know how I this works but I moved my ‘check the rigidbody y velocity’ if statement to a late update and it works fine! maybe because it is called after the move velocity? :slight_smile:

Isn’t working for me. All I am testing at this point is

print(rb.velocity.y < 0);

And my debugger spits out nothing but “false”, “false”, “false”, “false”,… whether I put it in Update(), LateUpdate() or FixedUpdate() and jump around. Absolutely ridiculous.

I’m late to the party but, comparing floats with != and == is not accurate.

Using Mathf.Approximately(float1, float2) is much better, and would fix your issues.