How to get rid of camera z-axis rotation

Started by
39 comments, last by BlackJoker 9 years, 7 months ago

Do you know how to apply your quaternion to a vector to rotate it? It's something like v' = q * v * conj(q). Plug in (0,1,0) and see what comes out.

For now I did like this:


Quaternion newQuaternion = qRotation;
            newQuaternion.Conjugate();
   
            Vector3 vector3 = Vector3.Transform(Vector3.Up, qRotation);
            vector3 = Vector3.Transform(vector3, newQuaternion);
            double angle = Math.Acos(Vector3.Dot(vector3, Vector3.Up));
            qRotation *= Quaternion.RotationAxis(vector3, (float) angle);

But this caused to view completely disappear in some angle and it not fixes roll issue. What I did wrong here?

This topic is closed to new replies.

Advertisement