Matrix Rotations

Started by
3 comments, last by ThirddaySaved 16 years, 8 months ago
Hey, I am having a really annoying problem... I can't figure out how I can get the real Translation of my Matrix, after Translating, Rotating, and then Translating again... So, here's some code example...

Dim Tester As Matrix
Tester = Matrix.Identity
Tester = Tester * Matrix.Translation(0, 0, 5)
 ' This first message box was correct - (0, 0, 5)
MsgBox(Tester.M41 & "," & Tester.M42 & "," & Tester.M43)
 ' I Rotate 90 degrees on the Y axsis...
Tester = Tester * Matrix.RotationY(90)
 ' Then I translate on the Z axis again, which after a 90 degree rotation
 ' should be equivelent to the old X axis.
Tester = Tester * Matrix.Translation(0, 0, 5)
 ' Ok, this second message box came up with this... (4.4, 0, 2.7)
 ' The numbers I was looking for were something like - (5, 0, 5)
MsgBox(Tester.M41 & "," & Tester.M42 & "," & Tester.M43)
I don't know what I am doing wrong... my camera always works, and doesnt have problems... but I just can't get the right Translation... If you could help that would be great! O, and I do plan on using Quaternions soon, but I would like to fully understand Matrices first...
Advertisement
If you're using the MDX Matrix class, then you need to pass in radians instead of degrees. 90 radians is about 117 degrees, which is consistent with the numbers you're getting.
Ya.. ur right... I guess thats actually a bad example... well, when im using my camera if i move around a while, and then go close to 0,0,0 ... many times i get numbers that are not even close to that... I don't really understand why... Thanks Though
It would probably be a good idea for you to look into the theoretical side of matrix mathematics. Simply examining individual elements will only be valid in a few isolated cases - you need to consider the matrix as a whole.

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Ok, thanks... thats basically what I was wondering... I read all about how they work and stuff, but I just never really looked closely at the actyal numbers... I was basically trying to find a way out of using too much math, but I guess I'll use some. Thanks You guys

This topic is closed to new replies.

Advertisement