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!
Has anyone else experienced this problem? I've implemented a pause game function and so of course the player needs to be looking at the same target when resuming the game as he was when pausing the game. But my pause game goes to the main menu and the mouse is used in the main menu so it still reads all that mouse input and then updates the game when it goes back to the game and the player is facing a completely different direction. I'm declaring this globally:
It seems simple enough and should work but it nevers does, sometimes it seems to be returning to a really strange camera position, other times it doesn't seem like it tried to restore the original position...
You're right it is called after pressing the ESC button to pause, but that should not matter. It should still get the current target. The pause game works by simply going to the main menu state where my Run_Game() function is not called. Run_Game() currently just calls a smgr-drawAll() so the scene manager is not updated while in the main menu, thereby pausing the game action. But I would think that the getTarget would still get the target and save it and then when the user selects the GUI button to return to the game, it calls setTarget and goes back into the run_game state. I tried adding another smgr->drawAll() after calling getTarget just to update it again but it did not affect anything.
You could try to do a
camera->setInputReceiverEnabled(false);
when switching to the menu and
camera->setInputReceiverEnabled(true);
when in the game again, maybe this helps.
Nevermind, I forgot I'm already checking a flag... it's too early in the morning. I have macro defined game states like GAME_RUNNING and MAIN_MENU etc. and it only returns mouse input to the camera when in the GAME_RUNNING state. But it's like it records all mouse input made while in the MAIN_MENU state and plays it all back real quick when it gets back to the GAME_RUNNING state so the player is facing a different direction. I don't understand why the setTarget won't work??? Or why the setInputRecevierEnabled won't work either??? Any other suggestions... anyone?
I've got a ordinary ICameraNode that follows my player around... but the "setTarget(node->getPosition);" is "bumpy". How would I make this 'smooth' so that its target is the model even when moving around?
(instead of posting on a new thread I thought it would be better to ask here)