Convex Hull collisions

aleradish
Posts: 22
Joined: Thu Mar 05, 2009 9:41 pm

Convex Hull collisions

Post by aleradish »

Hi...

I need to detect if a btCollisionObject Obj, collide with a btConvexHull...
for this I made that

for(int i=0;i<D->getNumManifolds();i++){
btPersistentManifold* many=D->getManifoldByIndexInternal(i);
btCollisionObject* objA=static_cast<btCollisionObject*>(many->getBody0());
btCollisionObject* objB=static_cast<btCollisionObject*>(many->getBody1());
if((objA==TargetObj&&objB==Point)||(objB==TargetObj&&objA==Point)){
LogManager::getSingleton().logMessage("Target e punto "+StringConverter::toString(TempVertex.x())+" "+StringConverter::toString(TempVertex.y())+" "+StringConverter::toString(TempVertex.z())+" collidono..");
InternalPoints[ActualPoint]=btVector3(TempVertex.x(),TempVertex.y(),TempVertex.z());
this->World->removeCollisionObject(Point);
this->World->performDiscreteCollisionDetection();
ActualPoint++;
LogManager::getSingleton().logMessage("NumContact:"+StringConverter::toString(many->getNumContacts()));
}else {
LogManager::getSingleton().logMessage("Target e punto "+StringConverter::toString(TempVertex.x())+" "+StringConverter::toString(TempVertex.y())+" "+StringConverter::toString(TempVertex.z())+"non collidono..");
}

}//for

I've seen that with this method I analize if a point is in contact with AABB of convex hull... but I want to know if is in conctact with the object (the contact of narrow phase?)

How I can Make?

Thank you so much
dangerdaveCS
Posts: 14
Joined: Mon Jun 07, 2010 5:37 am

Re: Convex Hull collisions

Post by dangerdaveCS »

Check out this wiki page:

http://www.bulletphysics.org/mediawiki- ... d_Triggers

It looks like you want to use the cool new (v2.76) contactTest()/contactPairTest() functions.

btConvexHullShape is ultimately derived from btCollisionShape, so can be used like any other collision shape, assumedly.
aleradish
Posts: 22
Joined: Thu Mar 05, 2009 9:41 pm

Re: Convex Hull collisions

Post by aleradish »

Ok... but I have 2.75.. Is not possible with that... do you think?

Do you think that if I configure 2.76 (without any problem) in my project ... method contactTest give me the EXACT collision between two btCollisionShape?.. are you sure?

Thank you so much...
dangerdaveCS
Posts: 14
Joined: Mon Jun 07, 2010 5:37 am

Re: Convex Hull collisions

Post by dangerdaveCS »

Yeah I had to download and compile v2.76 specifically for the contactTest() functions, they weren't there in 2.75.

The only function I've overriden for my version of ContactResultCallback is addSingleResult(), which gives two bodies and a crossing point between them via a btManifoldPoint (no penetration depth info or anything). So the same callback may be called with the same pair of objects for each crossing point - up to a hardcoded maximum of 4 points per pair of objects, so I believe.

As for "EXACT" - I believe you may want to look at btContinuousDynamicsWorld, or use a very very small timestep in your btDiscreteDynamicsWorld, in order for any kind of precision. Bullet doesn't focus on absolute precision in it's default setup.

Saying all this, I'm fairly new myself to Bullet, so read around the subject if possible rather than taking anything I type as gospel.
aleradish
Posts: 22
Joined: Thu Mar 05, 2009 9:41 pm

Re: Convex Hull collisions

Post by aleradish »

Thank you so much for your response... I have btCollisionWorld ... nothing of dynamics.. It go well?
I will try with bullet 2.76 if I find solution. Yes, it's true that Bullet uses AABB for the first contact calculation, but I think that has to be a method to find if two convex hull are in contact because 2 convex hull should be in contact where there is a contact between two points of a convex hull... I think...
aleradish
Posts: 22
Joined: Thu Mar 05, 2009 9:41 pm

Re: Convex Hull collisions

Post by aleradish »

Thank you so much for your response... I have btCollisionWorld ... nothing of dynamics.. It go well?
I will try with bullet 2.76 if I find solution. Yes, it's true that Bullet uses AABB for the first contact calculation, but I think that has to be a method to find if two convex hull are in contact because 2 convex hull should be in contact where there is a contact between two points of a convex hull... I think...It's not much for me too:)