Matrix Math

Started by
4 comments, last by jLeslie 23 years, 11 months ago
If I have a vector that is supposed to represent a rotation about an object''s x axis, how can I turn that into a rotation matrix?
Advertisement
If you mean that the x rotation is the x value of the vector, etc. you would use the X rotation matrix:
{1,0 ,0 ,0
0, cos(x),sin(x),0
0,-sin(x),cos(x),0
0,0 ,0 ,1}

y:
{cos(y),0,-sin(y),0
0 ,1,0 ,0
sin(y),0, cos(y),0
0 ,0,0 1}

z: same as x, shift elements into the top 4 positions.

For the full rotation, multiply all together.

(Radians, not degrees)




What is a man without goals? A dead man.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

I don''t :p
How does the vector represent the rotation? Is it a quaternion?

- WitchLord

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I''m trying to load a model from truespace, and I''ve almost got it, I just need to figure out how to use the vectors they have for the models local rotation with its transform matrix.
So each data object consists of:
center, 0,0,0
X Axis, 0,0,0
Y Axis, 0,0,0
Z Axis, 0,0,0
Transform, ..... A left-handed matrix with the columns and rows reversed.

If I just transform the model by the transform matrix it works fine most of the time...but some models come out rotated wrong, with body parts strewn all about And by looking at the data in the file I have to conclude that it''s because I''m not taking the X,Y, or Z axis vectors into account. But I''m not sure how I would apply them to the transform matrix.....Hope this comes out semi-coherent
My guess is that you should first compute the vertex coordinates like this

V'' = V.x*XAxis + V.y*YAxis + V.z*ZAxis + Center

Then transform V'' with the transform matrix.



- WitchLord

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement