Reputation: 85
I need to implement a way on how to get the Forward Vector. I've tried multiple approaches but every single time it only works for certain cases. I store the rotation as Euler angles, I tried converting them to Quaternions, I tried getting the view matrix from inverting the model matrix and getting the 3rd row of that matrix, and every single time I get a weird output. If the rotation is all zeroes, it works. If it is a multiple of 90 in any axis the output works, but if the rotation is, let's say, 45 degrees it doesn't work, the output is X: -0.707107, Y: -0, Z: 0.707107, which doesn't make sense. How I get the Forward vector:
glm::mat4 inverted = glm::inverse(CreateMatrix());
glm::vec3 ret = glm::normalize(glm::vec3(inverted[2]));
Upvotes: 1
Views: 176