penetration / strange contact pairs with contactPairTest

Michael Stengel
Posts: 6
Joined: Tue Jul 06, 2010 4:10 pm
Location: Wolfsburg

penetration / strange contact pairs with contactPairTest

Post by Michael Stengel »

Hi guys!
I try to resolve penetrations of two btBoxShapes. Therefore i want to get all contact pairs from Bullet properly. I'm using the Bullet contactPairTest.

Code: Select all

objectA = (btCollisionObject*) m_boxA_body;
objectB = (btCollisionObject*) m_boxB_body;
dyn_world->contactPairTest(objectA,objectB, renderCallback);
Unfortunately the results are not always feasible. Here there are two screenshots showing an example of the problem with the two boxes. One can see two contact pairs on the "screenshot 1" ( like one can expect because of the penetration ). If the smaller box is now translated a little, then only one contact pair is calculated ("screenshot 2"). The bottom face of the small box is penetrating the other box all the time. So i think there should be two contact pairs in both cases.

Does anyone has an explanation for this result ? Or is it not possible to get all contact pairs properly with the GJK algorithm of Bullet ? I would really appreciate some hints to solve this problem of the collision detection.

Michael
You do not have the required permissions to view the files attached to this post.
Michael Stengel
Posts: 6
Joined: Tue Jul 06, 2010 4:10 pm
Location: Wolfsburg

Re: penetration / strange contact pairs with contactPairTest

Post by Michael Stengel »

Hey guys! Nobody with an idea about this issue?
Maybe anybody could say, if this problem is a general problem or if it is worth to put it onto the issue tracker.

I already read about a bug also relating to missing contact pairs in the GJK implementation in an older Bullet version (see the following link), but these lines of code are fixed in Bullet 2.76, which i use for collision detection.
http://bulletphysics.org/Bullet/phpBB3/ ... irDetector

Also i read about some contact reduction happening in the GJK implementation. Does anybody knows some facts about it? Is there a way to deactivate or change this feature in order to ensure that alle contact pairs are found at all times ?

Michael
Michael Stengel
Posts: 6
Joined: Tue Jul 06, 2010 4:10 pm
Location: Wolfsburg

Re: penetration / strange contact pairs with contactPairTest

Post by Michael Stengel »

Hey physics experts!

Here is another example:

In my scene i have two convex hull shapes. The upper shape has 9 vertices, the lower one has 8 vertices (like a box).

Image

The positions of the collision shapes are directly set. If I start a collision detection (e.g. contactPairTest), I only get one contact pair as on the following screenshot.

Image

But i need all contact pairs from the collision detection as one can see in the next screenshot.

Image

Can anyone help ? This is really important to me.

Michael
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: penetration / strange contact pairs with contactPairTest

Post by Dirk Gregorius »

Hi Michael,

Bullet uses an incremental manifold finding one contact point per frame and manages them in a persistent manifold using several caching heuristics. So usually you will have the full manifold of four points after four frames. This is usually sufficient for game development. I think there is a method to find several points, but I am not sure whether this works for the penetration case. There might also be a contribution by Simon Hobbs which uses clipping and can build the full manifold at once. Check the extra folder for this.

Hope this helps,
-Dirk
Michael Stengel
Posts: 6
Joined: Tue Jul 06, 2010 4:10 pm
Location: Wolfsburg

Re: penetration / strange contact pairs with contactPairTest

Post by Michael Stengel »

Hi Dirk ! Thanks for reply.
I know there is this limitation of four contacts. I think this limit is sufficient for fast collision detection in games. But in my case more contacts would let me handle penetration more stable.

Do you know, if the limitation is only set in the btPersistentManifold or even in the GJK implementation of Bullet ? I think it is hard to change it, if the limit is directly coded in the GJK. Do you have an idea how to get over the limit ?

It would be time-consuming to implement another collision detection algorithm in Bullet and i think the GJK works fine for me apart from the contact limit. :(

Michael

PS: In the "Extras" folder i only find the CDTestFramework from Pierre Terdiman. Which file do you mean ?
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: penetration / strange contact pairs with contactPairTest

Post by Dirk Gregorius »

I assume you resolve the penetration yourself and only use Bullet for collision detection. Here is a sketch of an idea you could use to create several contact points:

1) Get the minimum translation vector (MTV) to resolve the penetration from Bullet
2) Find most parallel face to MTV on shape A
3) Find most anti-parallel face to MTV on shape B
4) Clip face from A against edge planes of face from B
5) Keep vertices below face A

I check for extra folder on my machine tomorrow. There should be a SAT implementation by Simon Hobbs.

HTH,
-Dirk