First let me start of by saying that I really appreciate the time you have been spending on this. It's really cool! Anyways I think I have found a bug. I have been trying to use the contact list in b2World to notify entities of collisions. Here is the gist of the code I wrote to process contacts.
When I run this code it seems that I only receive a notification about 50% of the time an object is hit. I'm no expert on the inner workings of the engine but it seems like contacts can be created and deleted within one call to Step before it returns. To attempt to alleviate this problem I hacked a similar loop into b2World::Step right before m_broadPhase->Flush() is called and it is able to catch most collisions but still not all. My guess is that it may have something to do with restitution since it seems to happen when there are collisions with bouncy objects.
Code:
mpWorld->Step(TIMESTEP, ITERATIONS);
for( b2Contact* c = mpWorld->GetContactList(); c != NULL; c = c->GetNext() )
{
if( c->GetManifoldCount() > 0 )
{
notifyContact(c);
}
}
for( b2Contact* c = mpWorld->GetContactList(); c != NULL; c = c->GetNext() )
{
if( c->GetManifoldCount() > 0 )
{
notifyContact(c);
}
}
When I run this code it seems that I only receive a notification about 50% of the time an object is hit. I'm no expert on the inner workings of the engine but it seems like contacts can be created and deleted within one call to Step before it returns. To attempt to alleviate this problem I hacked a similar loop into b2World::Step right before m_broadPhase->Flush() is called and it is able to catch most collisions but still not all. My guess is that it may have something to do with restitution since it seems to happen when there are collisions with bouncy objects.