I am probably missing something simple but ... this is how I'm calculating the world matrix of my object:

glm::translate(glm::mat4(1.f), mPosition) * glm::mat4_cast(mOrientation) * glm::scale(glm::mat4(1.f), mScale);

where mOrientation is a glm::quat type and it is set to identity via:

mOrientation(glm::vec3(0.0f, 0.0f, 0.0f))

What's strange is that my object keeps rotating over the Y-axis (world space) and to prove that it isn't my loop, I changed my world matrix calculation to:

glm::translate(glm::mat4(1.f), mPosition) * glm::rotate(glm::mat4(), 45.0f, glm::vec3(0.0f, 1.0f, 0.0f)) * glm::scale(glm::mat4(1.f), mScale);

And my object is static and is indeed rotated 45 degrees on the Y-axis. The key difference is that with Quaternion, it KEEPS rotating. What am I missing?

  • \$\begingroup\$ print out/show mOrientation every frame and see if it changes. \$\endgroup\$ – ratchet freak Nov 20 '17 at 10:08
  • \$\begingroup\$ Yup it was something simple :) I thought I was in a different revision ... \$\endgroup\$ – ChaoSXDemon Nov 22 '17 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.