diff --git a/glm/gtx/quaternion.inl b/glm/gtx/quaternion.inl index b29b53d8..31d39e48 100644 --- a/glm/gtx/quaternion.inl +++ b/glm/gtx/quaternion.inl @@ -232,9 +232,9 @@ namespace glm { mat<3, 3, T, Q> Result; - Result[2] = -direction; - Result[0] = normalize(cross(up, Result[2])); - Result[1] = cross(Result[2], Result[0]); + Result[0] = normalize(cross(direction, up)); // new right + Result[1] = cross(Result[0], direction); // new up + Result[2] = -direction; // new forward return quat_cast(Result); } @@ -244,9 +244,9 @@ namespace glm { mat<3, 3, T, Q> Result; - Result[2] = direction; - Result[0] = normalize(cross(up, Result[2])); - Result[1] = cross(Result[2], Result[0]); + Result[0] = normalize(cross(up, direction)); // new right + Result[1] = cross(direction, Result[0]); // new up + Result[2] = direction; // new forward return quat_cast(Result); }