Hello
What can I do to tell if a rigid body is falling or not falling?
I thought maybe just checking the Y velocity would be enough but that may = 0 when it first starts falling from the air.
So is there an easy way to tell that a rigid body is resting on another collision object/not falling?
Thanks
How to tell if a rigid body is on ground?
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: How to tell if a rigid body is on ground?
Well, if you know the ground is always below the object, then just checking for collisions (within a margin) will tell you if it's "on" the ground.
-
- Posts: 149
- Joined: Fri Jun 24, 2011 8:53 am
Re: How to tell if a rigid body is on ground?
This is a bit simplistic - which side is "below"? - but correct in practice.
I have been doing the collision check for a while and it appears to work just fine.
That is, if the collision manifold set is empty, the object is guaranteed to not touch anything and thus it's probably falling. I use this method to provide falling behavior to my kinematics.
Note however than while an empty set of manifold is guaranteed to mean "not touching", having contact points might still require falling behaviour. Be sure to consider distance relative to the object interested as manifold come unordered. You might need to invert manifold distance.
Even worse problem is "ground stickiness" because most objects don't really stop falling when hitting a wall. I've tried various methods to workaround this issue but so far I'm not satisfied myself.
I have been doing the collision check for a while and it appears to work just fine.
That is, if the collision manifold set is empty, the object is guaranteed to not touch anything and thus it's probably falling. I use this method to provide falling behavior to my kinematics.
Note however than while an empty set of manifold is guaranteed to mean "not touching", having contact points might still require falling behaviour. Be sure to consider distance relative to the object interested as manifold come unordered. You might need to invert manifold distance.
Even worse problem is "ground stickiness" because most objects don't really stop falling when hitting a wall. I've tried various methods to workaround this issue but so far I'm not satisfied myself.