cocos2d-x: can not create callback from onContactBegin

488 views Asked by At

I have problem with collisions. I use VS 2013 Community Edition and I create onContactBegin function like this:

bool GameScene::onContactBegin(cocos2d::PhysicsContact &contact)
{
    PhysicsBody* bodyA = contact.getShapeA()->getBody();
    PhysicsBody* bodyB = contact.getShapeB()->getBody();
    return true;
}

but when I try to create contact listener:

auto contactListener = EventListenerPhysicsContact::create();
contactListener->onContactBegin = CC_CALLBACK_1(GameScene::onContactBegin, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(contactListener, this);

my precompiler starts to cry on CC_CALLBACK_1 function:

no instance of overloaded function std::bind matches the argument list

Any help?

0

There are 0 answers