View Full Version : rotating and moving camera for FPS
Hi,does anyone know how to make the camera to follow a moving object and also to rotate according to what the object should see (it is simulation of an Aibo)? we are getting really complicated with the rotation matrix and the tranlation info .... the problem is that the Aibo moves by itself an we can get the position and rotation of the head, but we are unable to use this info to set the 1st person view...
We've managed to make the camera to follow the Aibo (it seems), but it seems that the coordinates rotated around each other every time we draw the image.
01-19-2004, 10:59 PM
A common mistake is to forget that the glTranslate and glRotate operations are made into matrix multiplications.
So you have to reverse the order of the operations : If you want to do 'translate then rotate', put glRotate then glTranslate.
Does this helps ? If I understood what you need, the camera has not to follow Aibo but rather display what it 'sees'.
I'll try it right now... http://www.opengl.org/discussion_boards/ubb/biggrin.gif
Anyways, every Aibo has a camera in the place where the nose should be in a real dog, the main idea is to emulate what that camera sees.
Solved it!! it's better to use glLookAt(). What we did was to create small boxes in the place where the camera supposed to be, the we placed another right in front of if (attached to the body with fixed joints), and another right on top of the first one (also attached). The idea of using fixed joints is to make the boxes move along with the head. Finally we used the coordinates of the first box for the eye coordinates, the second's for reference and the last one for the up vector (the last one's coordinates less the second's coordinates). This does the trick... http://www.opengl.org/discussion_boards/ubb/cool.gif
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.