Hm, you're having this in your while loop:
Code: Select all
if (Maya) {
//maya cam
camera[3] = smgr->addCameraSceneNodeMaya(); <---------------------
//Draw scene
smgr->drawAll();
}
//-----------------------------------------------------------------------------------------------//
//If Normalcam is used
if (Normalcam) {
//Normalcam
camera[3] = smgr->addCameraSceneNodeFPS(); <---------------------
camera[3]->setPosition(core::vector3df(-2000,200,0));
camera[3]->setRotation(core::vector3df(0,90,0));
camera[3]->setFarValue (50000.0f) ;
camera[3]->setFOV(1.1);
camera[3]->setTarget(core::vector3df(-2000,200,0));
//Draw scene
smgr->drawAll();
}
seems you're addin one camera each frame... thats no good.
Add 2 cameras
before the while(device->run())
MayaCam = smgr->addCamerraSceneNodeMaya(...)
NormalCam = smgr->addCamerraSceneNode(...)
these need to be global like the camera array
// before main()
ICameraSceneNode *MayaCam, *NormalCam;
you could also expand your camera array: camera[6] and use camera[4] and camera[5] instead...
then initialize
camera[3] = NormalCam;
in the eventReceiver say:
Code: Select all
//Key M enables Maya camera
if (event.KeyInput.Key == KEY_KEY_M && event.KeyInput.PressedDown)
{
camera[3] = MayaCam;
return true;
}
//Key N enables fps cam
if (event.KeyInput.Key == KEY_KEY_N && event.KeyInput.PressedDown)
{
camera[3] = NormalCam;
return true;
}
just quickly made this up, might contain error or two. But you get the idea...
Btw, would help a lot making your code more readably if you'd use some identation:
Code: Select all
main() {
while(true) {
if (false) {
}
}
}
instead of:
Code: Select all
main() {
while(true) {
if (false) {
}
}
}
