I try to translate objects after a rotation. I rotate objects with inputs events, stock the value of the rotation and use it for the translation. However, the objects translates with a wrong rotation. I don't understand why. here is pseudo code of my program :
translate :
for(int i = 0; i < numberObjects; i++)
objects.at(i) = glm::translate(glm::mat4(1.0f), newPosition.at(i)) * glm::rotate(glm::mat4(1.0f), valueOfRotation, glm::vec3(0, 0, 1));
rotate :
rotation = glm::rotate(glm::mat4(1.0f), valueOfRotation, glm::vec3(0, 0, 1));
for(int i = 0; i < numberObjects; i++)
objects.at(i) = objects.at(i) * rotation;
the rotation after translation works pretty well. Any idea please ? Thanks