Search code examples
androidcocos2d-xskybox

SkyBox cannot set scale on Android Cocos2d-x


With v3.7.1 I have trouble using setScale on Android only (it works on iOS).

auto textureCube = TextureCube::create("sky_left.JPG", "sky_right.JPG","sky_top.JPG", "sky_bottom.JPG","sky_front.JPG", "sky_back.JPG");
textureCube->retain();
//create a skybox
auto skyBox = Skybox::create();
skyBox->retain();
//set cube texture to the skybox
skyBox->setTexture(textureCube);
skyBox->setScale(1000.0f);
addChild(skyBox);

Though I changed the value of setScale, it's completely the same view.

However in scene3DTest setScale is used and applied. What's the difference?


Solution

  • I founded what I made the mistake. Add after camera created:

    camera->setCameraFlag(CameraFlag::USER1);
    setCameraMask(2);