Skip to content

Cameras do not work during Transition scene #12869

@ivcoder

Description

@ivcoder

Any nodes that have non-default camera are invisible during transition.

How to reproduce. Open HelloWorld project. Replace code inside HelloWorld::menuCloseCallback(Ref* pSender) with followed code:

    auto screenSize = Director::getInstance()->getVisibleSize();
    float zeye = Director::getInstance()->getZEye();
    auto camera = Camera::createPerspective(60, (GLfloat)screenSize.width/screenSize.height, 10, zeye + screenSize.height / 2.0f);
    // set parameters for camera
    Vec3 eye(screenSize.width/2, screenSize.height/2.0f, zeye);
    Vec3 center3D(screenSize.width/2, screenSize.height/2, 0.0f);
    Vec3 up(0.0f, 1.0f, 0.0f);
    //the calling order matters, we should first call setPosition3D, then call lookAt.
    camera->setPosition3D(eye);
    camera->lookAt(center3D, up);
    camera->setCameraFlag(CameraFlag::USER2);
    this->setCameraMask((unsigned short)CameraFlag::USER2, true);
    this->addChild(camera); //add camera to the scene



    Scene *scene = HelloWorld::createScene();
    // run
    Director::getInstance()->replaceScene(TransitionMoveInL::create(5.45f, scene));

Tap close button. Transition animation will start and current scene will immediately become invisible.

The same happens with the TransitionScene self when we add camera to it (If I want to make my own custom transition derived from TransitionScene).
Bug takes place because render() method of the scenes is not executed during transitions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions