Quote:
Originally Posted by mainy
Hello.
I am using a contact listener to work out when two fixtures collide. This is working as expected.
What I am attempting to do is flag up if three objects collide. I am unsure the best way of doing this and wanted to ask if there is already a standard approach.
Is it possible to first check if two objects collide (using the standard collision listener) and check if they are touching anything else?
Thank you
|
Use a collision listener, and upon collision you can access the complete collision list for the bodies:
Code:
for (b2ContactEdge* ce = myBody->GetContactList(); ce; ce = ce->next) {
b2Contact* c = ce->contact;
// do the checks here
b2Fixture* fixtureA = c->GetFixtureA();
b2Body* bodyA = fixtureA->GetBody();
// etc...
}