   Silly quaternion camera problem...
  I'm using quaternions to implement a simple camera. The camera holds it's position (m_vEye), the center of it's focus (m_vCentre) and it's up vector (m_vUp), which correspond to the parameters required for the gluLookAt function.To rotate the view, a quaternion is built from an axis-angle rotation. The quaternion is then applied to the m_vCentre variable. I know that my quaternion code is fine because it's driving my skeletal animation systemsMy questions:1. Is this method correct?2. What's wrong with this code?I've been over it with the debugger, but I can't find out what's causing the problem. Basically, when I apply rotation to the camera, no rotation occurs. At all.void Rotate(float fAngle, const Vector3f &vAxis){Quaternionf qRotation;qRotation.FromAxisAngle(fAngle, vAxis);m_vCentre = Quaternionf::RotatePoint(qRotation, m_vCentre - m_vEye) + m_vEye;}This is really beginning to annoy me. Any help will be greatly appreciated.   
  iNsAn1tY,Are you set on using quaternions for your camera?  If not, I wrote a camera a few months back for a fun little project.  It uses matrices, but supports all the basic camera functions including panning, zooming, rotating, orbitting, etc...I can post it here if you're interested.Cheers!   ;  Hi Jeromy, it would be great if you could post that camera code. I've just been using quaternions for a bit of practice really, and because I was using them for my skinned animation. I was considering switching to matrices, though. I need to work a little on my understanding of quaternions, I think :)   ;  I don't see anything wrong with the code you posted, but it should be easy to test. Just pass in a rotation with a known value (such as 90° around the X axis -- [.7071, 0, 0, .7071]) and see what comes out. If the rotation is always 0, then you should be able to spot the source of the problem very quickly in the debugger.   ;  John, I owe you a beer, mate.It was the FromAxisAngle function (in the library, with the revolver [grin]). I copied and pasted the code earlier today from an old program of mine, where it took the angle and three floats instead of the angle and a Vector3. I changed the function parameters, and some of the code inside, but there was a really subtle little error in there. Found it after I passed in a known rotation, like you said, and it didn't come out right. Thanks again.@jwalsh: I'd still be interested in seeing that matrix-based camera system, if you don't mind posting it. I'll post my quaternion-based one too, after a bit of clean-up.   ;  Heya Amigo,Here's my code for my matrix-based camera.  There's the Camera.h and Camera.cpp.  If you need me to post my vector and matrix library as well I can, but this should be sufficient to help you think it through. And congrats on getting your code working!Camera.hclass Camera{public:friend class Test;Camera( const Vector3& target, const Vector3& eye, const Vector3& up );// -- Public Interface -- //void Zoom( int32 delta );void Orbit( float32 yaw, float32 pitch );void Translate( float32 x, float32 z );// Accessorsconst Vector3& GetTarget( void ) const;const Vector3& GetEye( void ) const;const Vector3& GetUp( void ) const;// Mutatorsvoid SetTarget( const Vector3& vec );void SetEye( const Vector3& vec );void SetUp( const Vector3& vec );// Utility functionconst Matrix4& GetTransform( void ) const;private:void UpdateTransform( void );// -- Private Attributes -- //const uint32 m_MaxDistance;Vector3 m_Target;Vector3 m_Eye;Vector3 m_Up;Matrix4 m_Transform;};Camera.cpp//-------------------------------------------------------------------------------------------------//[Methods]//-------------------------------------------------------------------------------------------------Camera::Camera( const Vector3& target, const Vector3& eye, const Vector3& up ): m_MaxDistance( 20 ){m_Target = target;m_Eye = eye;m_Up = up;UpdateTransform();}void Camera::Translate( float32 x, float32 z ){Vector3 temp( x, 0.0f, z );m_Eye += temp;m_Target += temp;UpdateTransform();}void Camera::Zoom( int32 delta ){// Get the vector the camera lies uponVector3 dir = m_Target - m_Eye;-dir.NormalizeInPlace();// If greater than 0 the user wants to zoom inif( delta > 0 ){m_Eye += dir;}// otherwise, the user wants to zoom outelse if( delta < 0 ){m_Eye -= dir;}// Only the position of the camera is modifiedUpdateTransform();}void Camera::Orbit( float32 yaw, float32 pitch ){// Create a transform matrix....first rotation about Y axisMatrix4 rotationY;rotationY.BuildRotationY( yaw );// Get the direction vectorVector3 dir = m_Target - m_Eye;Vector3 right = dir.Normalize().Cross( m_Up );right.NormalizeInPlace();Matrix4 rotationX;rotationX.BuildAxisAngle( right, pitch );Matrix4 transform = rotationY * rotationX;// Transform the direction vector into a new directiondir = transform.Transform3( dir );// Subtract the new direction from the target to get the new eye positionm_Eye = m_Target - dir;// Both the position and orientation of the camera is modifiedUpdateTransform();}const Vector3& Camera::GetTarget( void ) const{return m_Target;}const Vector3& Camera::GetEye( void ) const{return m_Eye;}const Vector3& Camera::GetUp( void ) const{return m_Up;}void Camera::SetTarget( const Vector3& vec ){m_Target = vec;// Only the Orientation of the camera is modifiedUpdateTransform();}void Camera::SetEye( const Vector3& vec ){m_Eye = vec;// Both the position and Orientation of the camera can be modifiedUpdateTransform();}void Camera::SetUp( const Vector3& vec ){m_Up = vec;// Only the Orientation of the camera is modifiedUpdateTransform();}const Matrix4& Camera::GetTransform( void ) const{return m_Transform;}void Camera::UpdateTransform( void ){// Clear Transformm_Transform.SetIdentity();// Buil the translation componentm_Transform.BuildTranslation( m_Eye.m_X, m_Eye.m_Y, m_Eye.m_Z );// Compute the direction vectorVector3 dir = m_Target - m_Eye;dir.NormalizeInPlace();float angleX = dir.Dot( Vector3( 1.0f, 0.0f, 0.0f ) );float angleY = dir.Dot( Vector3( 0.0f, 1.0f, 0.0f ) );float angleZ = dir.Dot( Vector3( 0.0f, 0.0f, 1.0f ) );// Build rotation matrixMatrix4 temp;temp.BuildYawPitchRoll( angleY, angleX, angleZ );// Concatenate the matrices in the form M=T*Rm_Transform *= temp;}Cheers!   