camera stucks after "re-init"

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Flo
Posts: 11
Joined: Mon Dec 01, 2003 2:03 pm
Location: Germany

camera stucks after "re-init"

Post by Flo »

hiho :)

i've written a game with a main menu and the game itself.
for the first time i click on "new game" everything works fine, but when i return to the menu and click again on "new game" the camera isn't moveable anymore ...

so, here's the code of the camera:

initialization:

Code: Select all

irr::scene::ICameraSceneNode* camera;
if new game was pressed:

Code: Select all

camera = NULL;
camera = smgr->addCameraSceneNodeFPS(0,100.0f,500.0f);
camera->setFarValue(100000.0f); 
camera->setPosition(core::vector3df(0,100,0));
when returning to main menu:

Code: Select all

camera->grab();
camera->remove();

any idea why this happens?
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

you need to call setActiveCamera()

for some reason, the first time a camera is added, it is automatically set as the active camera, but from then on, new cameras have to be explicitly set as the active camera
a screen cap is worth 0x100000 DWORDS
Flo
Posts: 11
Joined: Mon Dec 01, 2003 2:03 pm
Location: Germany

Post by Flo »

thx, it works now :D
Post Reply