Original Post
Hi, I am using quaternions to represent rotations. How can I get a rotation quaternion, if I set a new camera target? Here is what am I doing: But it is not working as I want it to work. What is the way to make it right? Thank you in advance.
void CCamera::LookAt( vec3 pTarget )
{
vTarget = pTarget;
vView = vTarget - vPos; //New view vector
vView.normalize();
vec3 vViewInit(0.0f, 0.0f, 1.0f); //Previous view vector
vViewInit.normalize();
float angle = acos( dot_product(vViewInit, vView) );
qCurrent = CreateFromAxisAngle( ( vViewInit * vView ), angle );
}