游戏场景:

....
   auto edgeBody = PhysicsBody::createEdgeBox(winSize,PHYSICSBODY_MATERIAL_DEFAULT,3);
    auto edgeNode = Node::create();
    edgeNode->setPosition(winSize.width/2+origin.x , winSize.height/2+origin.y+10);
    edgeNode->setPhysicsBody(edgeBody);
....

球:
auto dinosaurBody = PhysicsBody::createCircle(dinosaurSprite->getContentSize().width/2);
dinosaurSprite->setPhysicsBody(dinosaurBody);

当球与边缘物体碰撞时,它会弹起,我该如何去除?

最佳答案

尝试

dinosaurBody->setRestitution(0)

也看看这个:http://cocos2d-x.org/programmersguide/12/

09-30 00:22