cocos2dx 3.7版本 设置刚体之后不显示

bool GameScene::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}

auto rootNode = CSLoader::createNode(“GameScene.csb”);
addChild(rootNode);

Size visibleSize = Director::getInstance()->getVisibleSize();

auto boxNode = Sprite::create();
auto boxBody = PhysicsBody::createEdgeBox(visibleSize, PHYSICSBODY_MATERIAL_DEFAULT, 3.0f);
boxNode->setPhysicsBody(boxBody);
boxNode->setPosition(visibleSize/2);
this->addChild(boxNode);

CCSpriteFrameCache::getInstance()->addSpriteFramesWithFile(“GameScene/GameScene.plist”);

auto ball = Sprite::createWithSpriteFrameName(“GameScene/Ball.png”);
auto ballBody = PhysicsBody::createCircle(ball->getContentSize().width/2);
ball->setPhysicsBody(ballBody);
ball->setPosition(Vec2(320, 100));
this->addChild(ball);
log(".2f, .2f", ball->getPositionX(), ball->getPositionY());
log(".2f, .2f", ball->getContentSize().width, ball->getContentSize().height);

auto paddle = Sprite::createWithSpriteFrameName(“GameScene/Paddle.png”);
paddle->setPosition(Vec2(320, 75));
this->addChild(paddle);

为什么设置这块代码之后 在ios模拟器上 球体有时候会显示 有时候会不显示呢?

发现它不是所有时候都不显示的,它是偶尔显示 偶尔不显示的 郁闷

发现原因了。。。。。原来我上一个场景切到这个场景有一个动画行为。。。。。。:6: