When the bird collide with the score line, it hold back the bird for a while.
Here is my source code
auto scoreNode = Node::create();
scoreNode->setPosition(topPipe->getContentSize().width / 2, 0);
scoreNode->setContentSize(Size(1, winSize.height));
scoreNode->setAnchorPoint(Point(0, 0));
scoreNode->setVisible(false);
this->addChild(scoreNode);
auto scoreBody = PhysicsBody::createBox(scoreNode->getContentSize());
scoreBody->setDynamic(false);
scoreBody->setCollisionBitmask(POINT_COLLISION_BITMASK);
scoreBody->setContactTestBitmask(true);
scoreNode->setPhysicsBody(scoreBody);
auto birdBody = PhysicsBody::createCircle(this->getContentSize().width / 2);
birdBody->setCollisionBitmask(HERO_COLLISION_BITMASK);
birdBody->setContactTestBitmask(true);
birdBody->setDynamic(true);
birdBody->setGravityEnable(true);
birdBody->setMass(10);
birdBody->setRotationEnable(true);
I want the bird get contact with the score line without stop for a while. How can I achieve it?
I'm using Cocos2d-x v3
Finally I have figured out the problem.
scoreBody->setCollisionBitmask(false); // set the collision bit mask to false to disable it
scoreBody->setContactTestBitmask(true); // detect by the contact instead