Public Group

# noob matrix questions

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

## 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 on other sites
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 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 on other sites
Quote:
 Original post by KoharThen 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.

1. 1
Rutin
67
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633416
• Total Posts
3011779
• ### Who's Online (See full list)

There are no registered users currently online

×