I started to learn quaternions and got very weak idea of how they work. So I blindly followed some tutorials on you tube on how to rotate object with glm.
I had problem with weird rotations when I used Euler angles once I switched to Quaternions rotation was normal, but now rotation gets fuzzy in terms that it changes speed, when it should be constant.
glm::vec3* rotationAngles = modelVertex->getRotation(); glm::mat4 translate = glm::translate(glm::mat4(1.0f), *modelVertex->getPosition()); glm::mat4 mQuat = glm::mat4_cast(glm::normalize(glm::angleAxis(glm::radians(rotationAngles->x), glm::vec3(1.0, 1.0f, 0)))); return this->perspective *translate * mQuat;
rotationAngles->x is constantly increasing by some constant (20 degrees)
In my loop I have code that goes angle+=20; and then rotation.setXAngle(angle);
Funny thing is this only happens when I’m using rotation on both x-axis and y-axis, when for example I only rotate on x-axis,speed does not change.