Ios Cocos2dx:落下的物理球穿过舞台

Ios Cocos2dx:落下的物理球穿过舞台,ios,iphone,xcode,cocos2d-x,game-physics,Ios,Iphone,Xcode,Cocos2d X,Game Physics,若我移动舞台,那个么球就会穿过舞台……若舞台并没有移动,那个么球就永远不会穿过舞台……如何将球设置为不穿过舞台 以下是代码: ball->addComponent(PhysicsBody::createCircle(ball->getContentSize().width*0.5f, PhysicsMaterial(10.0f,0.1,0.1))); ball->getPhysicsBody()->setGravityEnable(true); ball->getP

若我移动舞台,那个么球就会穿过舞台……若舞台并没有移动,那个么球就永远不会穿过舞台……如何将球设置为不穿过舞台

以下是代码:

ball->addComponent(PhysicsBody::createCircle(ball->getContentSize().width*0.5f, PhysicsMaterial(10.0f,0.1,0.1)));
ball->getPhysicsBody()->setGravityEnable(true);
ball->getPhysicsBody()->setRotationEnable(false);
ball->getPhysicsBody()->setDynamic(true);
ball->getPhysicsBody()->setTag(BALL_BODYS_TAG);
ball->getPhysicsBody()->setCategoryBitmask(0x01);
ball->getPhysicsBody()->setCollisionBitmask(0x02);
ball->getPhysicsBody()->setMass(10);
阶段:

stage->addComponent(PhysicsBody::createBox(stage->getContentSize(), PhysicsMaterial(100.0f,0.1,0.1)));
stage->getPhysicsBody()->setGravityEnable(false);
stage->getPhysicsBody()->setTag(STEPS_BODYS_TAG);
stage->getPhysicsBody()->setMass(100);
stage->getPhysicsBody()->setDynamic(true);
舞台移动代码:

void GBStage::updateStage(float dt)
{
    Vec2 pos = this->getPosition();

    pos.y += sBridge->gameSpeed;

    this->setPosition(pos); //Updating just sprite position

}
现在舞台向上移动,球落下。但球是通过舞台的。如何在舞台上停下来。我的代码怎么了


找到了临时解决方案。现在我停止了移动舞台精灵的位置。我用setVelocity来移动舞台。现在球永远不会通过台阶

this->getPhysicsBody()->setVelocity(sBridge->steps_Velocity);
但在带有Box2D的cocos2dobjc中,我们可以选择移动精灵位置并将精灵位置设置为物理体。现在在Cocos2d-x中,我们不能移动精灵并将其位置设置为身体。如果有人知道是否可以将精灵的位置设置为物理体,并且仍然可以使用精灵实现移动,请回答