Hi there. I’m using these codes in my player class for collision dedection.
auto contactListener = EventListenerPhysicsContact::create();
contactListener->onContactBegin = CC_CALLBACK_1(Player::onContactBegin, this);
Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(contactListener, this);
onContactBegin function;
bool Player::onContactBegin(PhysicsContact& contact){
CCLOG("%s","test collision");
return true;
}
but it’s not working.
