I am trying to use quaterions to modify the camera direction vector.
This code works perfectly:
glm::quat temp1 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.x * mouse_sens * time_step), glm::vec3(0.0, 1.0, 0.0)) );
glm::quat temp2 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.y * mouse_sens * time_step), dir_norm) );
Camera1.SetCameraDirection(temp2 * (temp1 * Camera1.GetCameraDirection() * glm::inverse(temp1)) * glm::inverse(temp2));
This code does not:
glm::quat temp1 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.x * mouse_sens * time_step), glm::vec3(0.0, 1.0, 0.0)) );
glm::quat temp2 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.y * mouse_sens * time_step), dir_norm) );
glm::quat temp3 = temp2 * temp1;
Camera1.SetCameraDirection(temp3 * Camera1.GetCameraDirection() * glm::inverse(temp3));
Why can I not multiply quaterions successfully? Am I using GLM wrong?