Is there a way to detect if a rigidbody is falling? Checking to see how long a node is not on the ground does not work that well.
Detect if rigidbody is falling
What do you mean by falling, and what have you tried that doesn’t work well/what is the issue with that?
I think there are several possible approaches, that may need to be combined:
SphereCast/RayCast to see if you’re on the ground.
Check that velocity.y_ is negative (or negative and greater than some magnitude). Check that there is/is not a contact (collision) with the ground.
Just checking to see. In Irrlicht there was a method called isFalling(). It basically had the logic to check if a node was falling.
Pretty sure there isn’t one, but I think since of the samples have an IsOnGround (or something like that function) you could take if you wanted to. The meaning of whether or not a node is falling is pretty game-dependent, so it’s probably better to put inside a character controller class anyways.
Yeah the character demo has an in air timer if the character is no longer making contact with the ground. Only problem is lets say the character jumps in a gravity lift that propels them somewhere. Since they dont make contact with the ground for a predetermined amount of time. Boom dead.
You should handle gravity lifts separately. While in gravity lift , don’t update the ground contact part of the code.
Only issue with that is a gravity lift as far as halo is concerned just propels you on somewhat of an arc through the air your not really standing on anything.
I just wondering what would be a good addition to the in-air timer.
I would suggest in whatever is altering the gravity/applying the force manually reset the in-air timer.
Wouldn’t that turn any lift into a lifesaving bug?
I think in-air-timers are error prone. For example when engaging in seemingly non-lethal piggybacking, or when landing on a descending elevator that
should
break your fall. I’m inclined to suggest using the
impulse
value of the relevant contact included with the
NodeCollisionStart
event instead.
That’s what I’ve been saying. You could use the gravity lift and similar things to disable fall damage.
@Modanung Do you have more details on this approach?
- Read impulse (see sample 18)
- Impulse too big? -> Ouch!
…where F represents the impulse in this case.
Questions?
This should also work when launched into a ceiling or wall, when disregarding the contact’s normal.
Okay sound great thanks man.