Closed Thread Icon

Topic awaiting preservation: OpenGL Following moving object (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=11875" title="Pages that link to Topic awaiting preservation: OpenGL Following moving object (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: OpenGL Following moving object <span class="small">(Page 1 of 1)</span>\

 
WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 02-02-2004 18:25

I am defining an object to move around in a circle via the following code:

code:
glPushMatrix();
glRotatef((GLfloat)pos, 0.0,1.0,0.0);
glTranslatef(1.2,0.0,0.0);
object.draw();
glPopMatrix();



pos is a variable that is updated via the timer from 0 to 359 for the rotation.

I then want to define the camera based on this object's current position. Which is set via the code
gluLookAt(cameraX,cameraY,cameraZ,LookAtX,LookAtY,LookAtZ,upX,upY,upZ);

From this code I am not sure how to derive the real coordinates of the object, since opengl works on changing the coordinate system as oposed to the objects coordinates.

What I believe that I need to do would be to simply get the LookAtX

Halma
Nervous Wreck (II) Inmate

From:
Insane since: Jan 2004

posted posted 02-03-2004 16:13

Umm.. I think it would work to extract the Modelview matrix and somehow apply it to the projection matrix.. I don't exactly know the details...

But could you possibly do it by keeping the object with the camera and moving everything else? For example, leave the object at (0,0,0) and then put the camera there.. All you would have to do then would be to adjust the camera angle (where it looks at), which is easy enough.. just a thought.


« BackwardsOnwards »

Show Forum Drop Down Menu