[Box2D] Get CCSprite from b2Contact

How i can get a CCSprite instance from b2Contact?

void StarContactListener::EndContact(b2Contact* contact)
{
    bool A = (contact->GetFixtureA()->GetUserData() != NULL);
    bool B = (contact->GetFixtureB()->GetUserData() != NULL);
    CCLog("Collision detected.");
}

Thanks!

Hello, 4idor,

My CCSprite object linked with b2Body and I have code like this:

b2Body* bodyA = contact~~>GetFixtureA~~>GetBody;
b2Body* bodyB = contact~~>GetFixtureB~~>GetBody;
CCSprite* spriteA = bodyA~~>GetUserData;
CCSprite* spriteB = bodyB~~>GetUserData();

Hope it helps.

Dmitry.

Hi Dmitry,

It works for me, so big thanks to you!

4idor