At the moment, I obtain this effect by adding the same element again and again whenever it needs to change. For example, when I board a spaceship (so that the camera must switch from one that moves in the horizontal plane only, to one that allows full 3D movement) I do this:
Code: Select all
camera = smgr->addCameraSceneNodeFPS(0,100.0f,0.025f,-1,keyMap,0,false,0.f);
Code: Select all
camera = smgr->addCameraSceneNodeFPS(0,100.0f,0.025f,-1,keyMap,4,true,0.f);
Code: Select all
gcp=guienv->addImage(guiplanets[planet],core::position2d<s32>(0,0));
Now, this works, but I find it inefficient, especially in the case of the GUI, because it keeps adding objects over objects and eventually the performance slows down to a crawl. I once made a stress test where a new GUI image was added not just when it needed to be changed, but once per cycle. As a result, in few minutes the framerate went below one frame per second.
How do I avoid this? Is there a way to change some of the properties of an existing object (in my case, the keymap size and vertical movement for the camera, and the image for the GUI) without adding it again?