#### Archived

This topic is now archived and is closed to further replies.

# orbit camera

This topic is 5355 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi Guys I think rotating the whole world around a point in the space is the same as orbiting the eye around the same point, my question is: can I physically orbit the eye while keeping the world stationary? how can we do that ? thanks Silvia

gluLookAt

##### Share on other sites
gluLookAt rovolves the world not the eye !!!

##### Share on other sites
Then don''t traslate the view - position vector back to the origin. Just glRotatef around the point you want to rotate around.

##### Share on other sites
quote:
Original post by silvia_steven_2000
gluLookAt rovolves the world not the eye !!!

The eye (or camera) is technically -never- rotated or moved at all. It always remains at (0,0,0) looking down the z axis. It is the centre of the universe and everything revolves around it.

##### Share on other sites
3D programming, the one time you can truely claim the world revolves around you

##### Share on other sites
quote:
Original post by Ostsol
quote:
Original post by silvia_steven_2000
gluLookAt rovolves the world not the eye !!!

The eye (or camera) is technically -never- rotated or moved at all. It always remains at (0,0,0) looking down the z axis. It is the centre of the universe and everything revolves around it.

I think she is likley referring to rotating about some point, other than the viewers local origin.

##### Share on other sites
im not sure if that is what you need or something you can build on.

what this does is rotating the "camera" (that doesnt really exist except as a selfmade class) in a way that a specified position in space will always remain at the same position on the screen. that was added to rotate the view in my level around a point i click on.

pos is the position in space, Position,Right,Up,Forward are the 4 vectors of the transformation matrix of the "camera" (that is later inverted to get the view matrix)

float tx,ty,tz;/*this stores the position of the point in "camera space", ie in the cameras coordinate system*/if (pos) {  float d[3]={pos[0]-Position[0], pos[1]-Position[1], pos[2]-Position[2]};  tx=d[0]*Right[0] + d[1]*Right[1] + d[2]*Right[2];  ty=d[0]*Up[0] + d[1]*Up[1] + d[2]*Up[2];  tz=d[0]*Forward[0] + d[1]*Forward[1] + d[2]*Forward[2];}//lazy today, let opengl do the math	glMatrixMode(GL_MODELVIEW);glLoadMatrixf(Transform);glRotatef(-deg, x,y,z);glGetFloatv(GL_MODELVIEW_MATRIX, Transform);/*place the "camera" in a way that the point will have the sameposition in the new camera coordinate system*/if (pos) {  Transform[12]=pos[0] - (tx*Right[0] + ty*Up[0] + tz*Forward[0]);  Transform[13]=pos[1] - (tx*Right[1] + ty*Up[1] + tz*Forward[1]);  Transform[14]=pos[2] - (tx*Right[2] + ty*Up[2] + tz*Forward[2]);}

the only way to truly move the world btw. would be to transform every single vertex yourself. everything you do with translate, rotate etc. will just change the matrix thats used to render your stuff. might be a personal preference if you consider that moving the viewpoint or the world. technically that would of course move the world, but as this math has to do be done anyway its not causing any additional work (except build and multiplying the matrix)

##### Share on other sites
The ''observer'' is fixed in the origin and it looks along Z axis forever!!! We move the world (MODELVIEW_MATRIX) in a way that it seems that there is a camera (simply by inverting rotations and translations). In other words we have only two matrices (matrices:right???) MODEL and PROJECTION. Projection is affected by FOV, znear, zfar...the rest is in the MODELVIEW.

PS: rotations are defined by an axis and an angle: you cannot rotate (orbit?) around a point.

##### Share on other sites
quote:
Original post by silvia_steven_2000
Hi Guys
I think rotating the whole world around a point in the space is the same as orbiting the eye around the same point, my question is: can I physically orbit the eye while keeping the world stationary? how can we do that ?

thanks

Silvia

It is the same, but that being so, why do you want to do it the other way? The look should be the same, but you''re doing extra work to make it so.

• 18
• 11
• 17
• 9
• 51
• ### Forum Statistics

• Total Topics
631396
• Total Posts
2999792
×