ContactAddedCallback not called

thloh85
Posts: 26
Joined: Mon Feb 09, 2009 10:07 am

ContactAddedCallback not called

Post by thloh85 »

Hello,

I've tried implementing gContactAddedCallback, and have a problem with it. In usual collision, the function will be called, but in rare condition - when you "touch" and edge of a rigid body (in my case, a box, btBoxShape) with edge of another rigid body (in my case, a sphere, btSphereShape). Below is the screenshot of what's happening

Image

The box on top should have contact with the sphere on the left, because it is "pushing" the sphere away, but gContactAddedCallback was not called (I print something when it is called).

Can anyone help me with this?

Thanks a lot.
You do not have the required permissions to view the files attached to this post.
FlyingHaggis
Posts: 3
Joined: Mon Jul 14, 2008 3:40 pm

Re: ContactAddedCallback not called

Post by FlyingHaggis »

I am having a similar problem, where objects that just skim by each other sometimes don't call the gContactAddedCallback function I set.

I have tracked it down to this bit of code:

void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth)
{
btAssert(m_manifoldPtr);
//order in manifold needs to match

if (depth > m_manifoldPtr->getContactBreakingThreshold())
return;

...


When it goes wrong the depth is greater that the contact breaking threshold so it never adds a new contact point for this collision, therefore it never calls your callback function. There is a global variable <gContactBreakingThreshold> you can adjust to make this go away in a hacky way but I would still like to have the proper solution ;)

Cheers
-flyingHaggis
thloh85
Posts: 26
Joined: Mon Feb 09, 2009 10:07 am

Re: ContactAddedCallback not called

Post by thloh85 »

Wow, it's amazing how fast I get reply.

So, I'll have to recompile the library to get this to work? A little annoying...

Thanks a lot for your quick reply... Helped me a lot...

Edit: It seems that I can just set the global in my simulation, silly me. Thanks again, great community :)