• Advertisement
Sign in to follow this  

noob matrix questions

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

Ok so I have this first person shooter game that I’ve been working on and everything in it was fine using my vector class. Then I heard all the pro’s use matrices to represent 3d location so I converted my vector class into a matrix class. Now my only problem is when I’m at 0,0,0. I can rotate just fine using the matrix rotation funcion, but when I translate out and then rotate the camera, the whole camera also translates in a circle with radius equal to whatever I first translated out. So moving then rotating puts me in the same place as rotating first then moving. What is a good way to handle this situation? thanks for your help guys gamedev is the best.

Share this post


Link to post
Share on other sites
Advertisement
You lack the requisite comprehension of linear algebra, specifically as it related to 3D graphics. You should locate a good book. I would recommend "The Geometry Toolbox" for the math, specifically, and "Fundamentals of Computer Graphics, 2nd Ed."

The documentation for your graphics API -- the Red Book for OpenGL (available online) and the DX SDK, as appropriate -- have sections dedicated to transformations and how they apply to the graphics pipeline, specifically. They may not cover the math as well as you'd need to get a proper understand, though.

You might also want to check out legalize's book which covers the subject for D3D.

Share this post


Link to post
Share on other sites
It sounds like you are multiplying the matrices in the wrong order. Try switching them around. If you are having more problems, check out the "Articles & Resources" section of the website. The Math and Physics section has plenty of tutorials on using matrices.

Greggles

Share this post


Link to post
Share on other sites
Quote:
Original post by Kohar
Then I heard all the pro’s use matrices to represent 3d location so I converted my vector class into a matrix class.


I guess this is true, since a vector is just a 3x1 or 4x1 matrix. 4x4 matrices are generally used to represent transformations.

To rotate an object in place (I assume that's what you're trying to do), you could translate the object to the origin, rotate it, then translate it back.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement