Glm Quaternion lookat function
问题 I am trying to write a lookat function that uses glm::quat to represent rotations, based of off this answer. I am running into trouble getting a correct angle however. This is my lookat function: void Camera::LookAt(float x, float y, float z) { glm::vec3 lookVector = glm::vec3(x, y, z); assert(lookVector != position); glm::vec3 direction = glm::normalize(lookVector-position); float dot = glm::dot(glm::vec3(0, 0, -1), direction); if (fabs(dot - (-1.0f)) < 0.000001f) rotation = glm::quat