void Player::physicsSetUp() { //listen to contacts auto contactListener = EventListenerPhysicsContact::create(); contactListener->onContactBegin = CC_CALLBACK_1(Player::onContactBegin, this); contactListener->onContactSeperate = CC_CALLBACK_1(Player::onContactSeperate, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(contactListener, this); //physics body auto playerPhysicsBody = PhysicsBody::createBox(Size(getBoundingBox().size.width, getBoundingBox().size.height*0.25)); playerPhysicsBody->setPositionOffset(Point(0, -getBoundingBox().size.height*0.35)); playerPhysicsBody->setContactTestBitmask(PLAYER_CONTACT_MASK); playerPhysicsBody->setRotationEnable(false); setPhysicsBody(playerPhysicsBody); }