I used b2ContactListener class to identify collision. All other body collision identification is successful. How can I find other b2body collision with ground body?
Collisions happen in box2d between fixtures, not bodies. That's why you might have some code in your contact listener that looks like
contact.fixtureA = contact->GetFixtureA();
contact.fixtureB = contact->GetFixtureB();
If you're using the sprite as the user data for each of the bodies, you still have the option of putting whatever you'd like into the fixture's userdata field. Something like this is quite helpful:
fixtureUserData *fUd = new fixtureUserData();
fUd->tag = INT_IDENTIFYING_GROUND_FIXTURE;
// ...
b2FixtureDef groundBoxDef;
groundBoxDef.userData = fUd;
Where you've defined in your .h file a struct that might look like
struct fixtureUserData {
int tag;
// ...other properties
};
The INT_IDENTIFYING_GROUND_FIXTURE could also be an element of an enumerated type (you might have one element of that type per collision category). If you've done this, you can then test for collision with the ground by doing
fixtureUserData *fBUd = (fixtureUserData *)pdContact.fixtureB->GetUserData();
if (fBUd->tag == INT_IDENTIFYING_GROUND_FIXTURE){
// react to collision
}