Jump to content
  • Advertisement

Archived

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

jLeslie

Matrix Math

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

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!