Advertisement Jump to content


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


3D Game Engine Camera Movement

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have no idea how to do this. I just need to know how to move the viewport around the 3D world. I have 2 different ideas of what this is by reading what some people have posted. It is either keeping all of the 3D world's objects' coordinates the same and moving the coordinates of the player's view around, or it is translating every single object in the viewable world. I think it's the first because the second would seem to take up a lot of processing time.

Share this post

Link to post
Share on other sites
I think you meant the 3D world, and not the viewport. Viewport is a two dimensional rectangle of your 3 dimensional world. Everything not in your viewport gets clipped. Basically, you have 3 matrices to work with in Opengl or DirectX. You have the world, view, and projection matrices. You start up by drawing your objects in model space which is x=y=z=0, and you make a world matrix with rotation, translation, and scale that tell you how far your object moves from the world coordinates that are x=y=z=0. For example if you want to move your model along the positive x-axis, use a translation function and put some value for the x coordinate, this will multiply your vertices by the translation matrix and move your model from the world's coords x=y=z=0 to y=z=0 and x=some value. So in DirectX you first build the world matrix, then the view, and you normally don't manipulate the projection matrix once it's set up. Your vertices will be multiplied by world, view, and projection matrices. Do as I do and use gluLookAt() or D3DXMatrixLookAtLH(), matrices, they'll take care of your view matrix. Then only manipulate world matrix to place your objects and if you want to move around your world use the LookAt functions to manipulate your camera or view matrix. You don't move around in your world, but your objects do. You manipulate the view matrix to move your objects further out or in from the current world position and this gives the illusion that you are moving around in your world. By the way, in DirectX once you build your world, view, and projection matrices don't forget to set them since the api is a state machine. In opengl you have model and view matrix in one, and projection separate, in DirectX all 3 are separate. Hope this helps and good luck!

[This message has been edited by JD (edited November 16, 1999).]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!