Monday, 5 November 2012

Week 9 – Creating several camera functions and swapping between them



              The past week has been hectic, where I had to create lots of models for my game design course homework, and I also had to work on getting the art assets ready for the upcoming milestone for GDW. With the little time I had to work on game engines homework, I worked on medium homework question number 7, which requires me to make and swap between 5 different cameras: first person, third person, over-the-shoulder, fixed-cinematic, and Maya cameras.


                I started off with creating 2 different cameras, named Cam (for the first person camera and the default camera for the others) and Cam2 (for the third person camera). I pretty much replaced the vector for the camera lookAt function with a vector that is changed depending on which camera the user selects. The same system is also used for the camera’s position and also this: OGRE_CORE->mViewport->setCamera(Cam);. I then created keyboard functions that will trigger a Boolean expression, which will then trigger an “if” statement inside my update function. This will allow the user to change between the 5 different camera types. This is where I put that line of code mentioned earlier, along with the camera’s position and the lookAt function, and it will swap into the camera that the user chooses. I also allowed the user to use the WASD keys in order to move the object forwards, backwards, and to turn left and right.
                This program is currently not completed yet, and only features camera swapping and the movement of the object while allowing the camera to follow it (first person camera only). I am still trying to figure out how to make the object and camera move in the direction that the user turns to (by using the S and D keys), as it is currently only moving in the default direction, which is straight ahead, regardless of the orientation of the object.
                Stay tuned for more updates on my game engines progression!

No comments:

Post a Comment