This is my 10th blog for game engine, and i think it's the last blog post for this year. Although I already got enough exp for the final exam, I still want to get more marks to increase my final grade, so I was working on more homework questions last week.
Question 10 seems like a pretty good one and an interesting question, therefore I started working on the Interactive and Fixed Cinematic camera. Since the base question required us to export path from Maya, I can only implement them using the ogre animation class. One thing I had worry about at the beginning is to switch between different animation tracks. I declared two animation tracks and tried to switch them when user input from keyboard. I did check the code several times then I ran the program after I thought it was perfect but it was certainly not working in the way I expected. In the following two hours, I kept checking the part where I get the locators and create the animation but I could not find anything wrong.
I thought the problem was from the animation part but I finally realized that it wasn't. The animation didn't change after I pressed the key. I then compared the code to my previous works and I found that I missed these two guys:
OGRE_CORE->mMouse->setEventCallback(this);
OGRE_CORE->mKeyboard->setEventCallback(this);
Small things can cause big and major problems. After I put keyboard handles in the enter function, everything worked as I expected. This also reminded me that I made the same kind of stupid mistake last year.
I think the fun part of question 10 is to implement numbers of fixed cinematic cameras and make them work together. I thought it was very hard, but after trying several ways I found that I could simply make the camera focus on the character by updating the lookAt point of the camera.
Ogre::Vector3 lookAt = Ogre::Vector3(0,10,0) + bearNode->getPosition();
Where bearNode is my character node, I added a vector to the character position to make it looks more cinematic. Before using the getPosition(); function, I used a position vector instead, I realized that I can only get the position directly from the node to update the camera, otherwise the camera would keep looking at the starting position of the character and won't be updated after the character is being moved. This was the second stupid mistake I have made when doing question 10.
No comments:
Post a Comment