Jump to content
  • Advertisement

Archived

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

_Rambo_

Matrices...

This topic is 6062 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

Hi, i''m doing a 3d engine and i have some doubts about matrices, so...here we go!!! I''m using a 3x3 matrix to represent camera matrix and a CVector class to represent camera position. When i press the right key: If (keys[VK_RIGHT]) { camera.rotateY(1 * piover180); camera.yrot += 1.0; } The same happens with VK_LEFT but instead of positive values i use negative values. camera.rotateY(1 * piover180); constructs y rotation matrix and then multiplies it by the current matrix. So...the camera matrix is now facing the correct position but the camera isn''t until i use glRotatef(). I''m using the camera.rot to know how much i must rotate the scene with glRotatef(360.0 - camera.yrot, 0.0, 1.0, 0.0); Isn''t this information(how much the scene must be rotated) stored in the matrix ? If not, then i ask, i should use this matrix for what ? The movement system is working fine but i would like to know if i am doing it in the right way. Moving forward: if (keys[VK_UP]) { camera.position.x += sin(camera.yrot * piover180) * 0.05; camera.position.z += cos(camera.yrot * piover180) * 0.05; } The same happens with VK_DOWN but instead of += i use -=. So...my questions are: The matrix provides information to use in glRotatef(HERE, 0.0, 1.0, 0.0); ? If not, the matrix is used for what ? Thanks...

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!