I am using Ogre, and to simulate jumping, I am checking if the Y-part of velocity is equal to 0 (is touching the ground).
The thing is that it is never 0, even if it is touching the ground. It is always a really small value.
What should I do to check if my rigidbody is on top another object? Thanks.
Detect rigidbody on ground: Y-part of velocity is never 0
-
- Posts: 26
- Joined: Sat Jun 15, 2013 2:29 am
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: Detect rigidbody on ground: Y-part of velocity is never
Try checking if |y|< epsilon, where epsilon will have to be a non-zero but very small number. Physics engines in general tend to have non-exact performance when dealing with non-exact solutions (like PGS in bullet). It's the same reason why stacking multiple boxes is difficult and often used to check engine stability.
Probably better to just check for contact using contact manifolds, raycasts, etc (again, some tolerance may be needed), since you can have non-contact zero velocity if you're bouncing off something (and falling back down).
Probably better to just check for contact using contact manifolds, raycasts, etc (again, some tolerance may be needed), since you can have non-contact zero velocity if you're bouncing off something (and falling back down).