项目需要用到三维模型,但是加入背景以后,发现模型永远都会显示在下面,被背景盖掉。
即Sprite3D和Sprite的位置出现重合时,永远都是Sprite显示在前面,不管如何调整Z,都无济于事。
我想知道现在加入2D背景以后,怎么把背景放到下面,不把模型覆盖掉呢?
下面是我在新建的HelloWorld程序里面init函数的代码
{
…
// add “HelloWorld” splash screen"
auto sprite = Sprite::create(“HelloWorld.png”);
// position the sprite on the center of the screen
sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
// add the sprite as a child to this layer
this->addChild(sprite, 0);
auto sprite3d = Sprite3D::create("planet_1.obj","planet_1.tga");
this->addChild(sprite3d,255);
sprite3d->setPosition(visibleSize/2);
sprite3d->setScale(400/sprite3d->getContentSize().width);
return true;
}