I implemented collision groups to the previous version of Box2D. Unfortunately you cannot port it directly to the new version, because of the different way it handles collision detection.
Collision groups aren't that difficult to implement. The way I did it was I added a collisionGroup attribute to the Body -class and a collision group matrix to the World -class. And when collision where being detected I'd check from the collision group matrix if the two bodies had collisions flagged between them. If they didn't it would skip those bodies.
Here's a small part that explains what I'm trying to say, from the World's BroadPhase -method.
Code:
for (int i = 0; i < (int)bodies.size(); ++i)
{
Body* bi = bodies[i];
for (int j = i + 1; j < (int)bodies.size(); ++j)
{
Body* bj = bodies[j];
// here's the collision group matrix check
if( collisionGroupMatrix[ bi->collisionGroup ][ bj->collisionGroup ] == 0 )
continue;
Arbiter newArb(bi, bj);
...
}
}