I'm new to Bullet Physics and I have just set the engine up to detect collisions between objects by iterating through the contact manifolds of the btDynamicsWorld similar to this page. I'm making a 3D platformer and I would like to determine not just if the player collides with an object, but if he has collided with the "top" of an object. What would be the best way to detect this in Bullet?
Thanks.
Detecting "top" collisions.
-
- Posts: 149
- Joined: Fri Jun 24, 2011 8:53 am
Re: Detecting "top" collisions.
If the "top" is everything above the center of mass, manifolds can give out points on both objects, in world space.
So, if we have our point and the centre of mass (which you can get with relative ease) then we can figure out if an object is "on top" of another by dotting the displacement vector against gravity.
If the "top" is "a face looking up" then we can use the normal from manifolds (I think it's called normalOnB or something) and again dot it with gravity to see if it's looking up or down.
So, if we have our point and the centre of mass (which you can get with relative ease) then we can figure out if an object is "on top" of another by dotting the displacement vector against gravity.
If the "top" is "a face looking up" then we can use the normal from manifolds (I think it's called normalOnB or something) and again dot it with gravity to see if it's looking up or down.