PDA

View Full Version : movingWorld



masonium
07-14-2001, 07:20 PM
Whenever I try to make the camera move and the world stay still, the camea is stationary and the world moves around. How do I prevent that?

07-14-2001, 10:43 PM
Well, what is the difference? http://www.opengl.org/discussion_boards/ubb/smile.gif

Ritchie
07-14-2001, 10:46 PM
Are you sure that is what happens? The effect of moving the camera is that the scene as a whole is moved. The Tech FAQ has a good suggestion on how to deal with camera movement. See sec. 8.060

Ritchie

Tim Stirling
07-15-2001, 01:03 AM
Reverse the direction around, to move through the world you have to move the world the oposite way.

If you press forewards in your program then the world move forewards, therefore you appear to move backwards. Translate the negative of this and all should be well.

glLoadIdentity();

glRotatef(Camera.bob, 0.0,0.0,1.0); // not needed
glRotatef(Camera.xrot,1.0,0.0,0.0);
glRotatef(Camera.yrot,0.0,1.0,0.0);

glTranslated(-Camera.x,-Camera.y,-Camera.z);

Here is a snippet of my code, you see I hold the position in Camera but for renderinmg purposes these have to be negative to move the world.