XNA quanternion multiple axis
Hey all, I'm working on a static camera class (for my own use, if I ever complete it and have it working ill post here) in XNA.
I made a working version using absolute vextors being rotated by matrices and keeping relative vecotrs for translations. What I didnt like is that I HAVE TO use the standard XYZ axis for rotation.
What I decided to do was use quanternions to store current rotation,cthen buffer rotations each time some were done and add it up.
The way I see it, it should look somewhat like this:
(in the UpdateRotation part, plz dont mind any typos i make, this isnt the actual current code. Also on a small note I use dictionaries, so dont be surprised xD)
Code:
RelativeVectors["Up"] = Vector3.Transform(AbsoluteVectors["Up"], (Quanterion)CurrentRotation);
//repeat for Look and Right relative vectors
Quanternion Yaw = Quanternion.CreateFromAxisAngle(RelativeVectors["Up"], RotationBuffer["Yaw"]);
//repeat for roll and pitch
CurrentRotation = Quanternion.Contancate(CurrentRotation,(Yaw*Pitch*Roll));
//clear the rotation buffer
Whats happening right now tho, is that doing this exactly doesnt actually do anything, so I have to use standard axis anyway. If you need I can copy the whole class into here, but that may not be necessary xD, i hope.