It looks like the TestBed Presolve function by Simon Oliver collects contact points from the world manifold. That code is:
void PreSolve(b2Contact* contact, const b2Manifold* oldManifold) {
const b2Manifold* manifold = contact->GetManifold();
if (manifold->m_pointCount == 0)
{
return;
}
b2Fixture* fixtureA = contact->GetFixtureA();
b2Fixture* fixtureB = contact->GetFixtureB();
b2PointState state1[b2_maxManifoldPoints], state2[b2_maxManifoldPoints];
b2GetPointStates(state1, state2, oldManifold, manifold);
b2WorldManifold worldManifold;
contact->GetWorldManifold(&worldManifold);
for (int32 i = 0; i < manifold->m_pointCount && m_pointCount < k_maxContactPoints; ++i)
{
ContactPoint* cp = m_points + m_pointCount;
cp->fixtureA = fixtureA;
cp->fixtureB = fixtureB;
cp->position = worldManifold.m_points[i];
cp->normal = worldManifold.m_normal;
cp->state = state2[i];
++m_pointCount;
}
}
cp->position = worldManifold.m_points[i];
cp->normal = worldManifold.m_normal;
...provide the contact direction and position of colliding objects. So the trick might be to copy that into a variable and choose which contacts you want.
In my code I'm looking into user data to find out what's colliding. These are reported as fixtureA and fixtureB at the start of the code. Both need to be tested for the object you look for. With the fixture you can also get the body attached.
I hope this helps!