I’m trying to use two cameras for my 2D game - one for UI and second for the world. World camera will be moved around.
As there is default camera with DEFAULT flag in the scene, I tried to create just one additional camera in init method with USER1 for the world, set camera flag USER1 for world node after all children are added and moving camera works but there are two issues:
- World is rendered above UI. As I understand, default scene camera has DEFAULT flag and should render last (that is on top)
- I’m using scene transition with Director::getInstance()->replaceScene(TransitionFade…) and world camera starts rendering only after fade transition ends. So it looks weird as UI is visible and world pops in after delay finishes.
If I create second camera and add it as child to scene, then render order is correct but transition problem exist. After doing it Director::getInstance()->getRunningScene()->getCameras() size is 3.
Can someone explain how to use two cameras for 2D ?