View Full Version : Changing the camera look at
07-30-2010, 08:33 AM
I have a scene that as a robot with a sphere as its head. i want to be able to change the camera as if it were looking through the eyes of the robot.
Is there an easy way of telling where the center of the sphere is and how to locate the camera in that way
07-30-2010, 09:55 AM
If you are using fixed functionality, gluLookAt() is the simplest way for that.
If you are using shaders, take a look at the implementation of glLookAt() function, and build up your model-view matrix on the same way, before sending it to the vertex shader as a value of some uniform variable.
07-30-2010, 11:08 AM
Thank you for the reply,
The problem i'm having is with the function gluLookAt and if it's possible to move and rotate the object and the camera the same way , to make it look like the viewing is from the object eye
07-30-2010, 11:25 AM
Then you don't have to move/rotate object that represents a head. In fact, you have to move/rotate the whole scene (except the body) according to the head movements. Be sure that you correctly understand model/view transformations.
07-31-2010, 10:49 AM
That worked beautifully
thank you very much
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.