i'm trying to make a simple game in Irrlicht, for learning both C++ and Irrlicht itself. but i'm having trouble with a simple function. considering this code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
and in iniGameSys() definition, we have this line: game_camera.getCameraNode() = scenemgr->addCameraSceneNode(0, irr::core::vector3df(0,0,20), irr::core::vector3df(0,0,0));
which gives the error:
lvalue required as left operand of assignment
however, if i change "camera" to public in the class GameCamera, and try to acess like this: game_camera.camera = scenemgr->addCameraSceneNode(0, irr::core::vector3df(0,0,20), irr::core::vector3df(0,0,0));
then i have no errors, and everything compiles fine. so, i guess it's not an Irrlicht error. i think it's some pointer or function i'm not handling correctly.
The pointer that is returned by game_camera.getCameraNode() is a copy of the game_camera.camera pointer. Assigning to the copy would be useless because the copy would be gone at the end of the line anyway so that's why it's not allowed. Why not add a function setCameraNode that you can use to set the pointer.