Collisions : how to compute penetration depth?

pognibene
Posts: 6
Joined: Sat Dec 16, 2006 2:53 pm

Collisions : how to compute penetration depth?

Post by pognibene »

Hello,

I have some code to test collisions between a primitive (Y aligned cylinder)
and a concave static trimesh. This code based on the collision interface demo.
This works OK, but I only have *contact points* when browsing the manifold
list. I'd need instead to have a vector describing the penetration depth and
its direction. (I plan to use it to apply a steering algorithm to my
cylinder/player to avoid obstacles).

Is there a way to do this without using impulse and the whole dynamic
world sheebang? My cylinder primitive is a kinematic object with no
physical properties (just like in the collision interface demo).

Any help is welcome!

-pogn
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

The contact points contain information about penetration depth and normal direction:

cp.getDistance(); //when negative this is penetration depth, otherwise distance
cp.m_normalWorldOnB // direction

Hope this helps,
Erwin
pognibene
Posts: 6
Joined: Sat Dec 16, 2006 2:53 pm

Post by pognibene »

Erwin Coumans wrote:The contact points contain information about penetration depth and normal direction:

cp.getDistance(); //when negative this is penetration depth, otherwise distance
cp.m_normalWorldOnB // direction

Hope this helps,
Erwin
Wow, that's cool :-) Going to try this right now.

Thank you very much for your help!

pogn