Matrix Math
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?
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.
{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.
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement