Guys,
I'm pulling out my hair cuase this should be easy, but I can't figure out why in the world my camera class is not working, here's the code for the rotation:
void Camera::Rotate(float angle,float x,float y,float z)
{
Quaternionf temp, quat_view, result;
temp.x = x * sin(angle/2);
temp.y = y * sin(angle/2);
temp.z = z * sin(angle/2);
temp.w = cos(angle/2);
quat_view.x = m_LookAt.X();
quat_view.y = m_LookAt.Y();
quat_view.z = m_LookAt.Z();
quat_view.w = 0;
Quaternionf preConj = temp * quat_view;
temp.Conjugate();
result = preConj * temp;
m_LookAt.X( result.x );
m_LookAt.Y( result.y );
m_LookAt.Z( result.z );
}
Here's how my game initializes the camera:
m_Camera.Position(50.0f,600.0f,-300.0f);
m_Camera.LookAt(50.0f,0.0f,0.0f);
m_Camera.Up(0.0f,1.0f,0.0f);
m_Camera.Far(3000.0f);
m_Camera.Near(1.0f);
m_Camera.Aspect(3.14f/4.0f);
m_Camera.FOV(800.0f/600.0f);
And lastly, I'm just trying to get the rotation working, so during update I'm calling this;
m_Camera.Rotate(0.1f,0.0f,1.0f,0.0f);
It just jiggles the camera, but no real movement??? Any ideas???
Thanks in advance
Jeff.