What is the way to make all the objects that are not aligned with the origin center (vector3(0.0f,0.0f,0.0f)) , rotate about its own central axis?
the problem in pseudo code:
vector3 vector3 objectCenter = (10,5,0); // current object center
vector3 vector3 objectPosition = (40,5,0); // Place to translate the object
vector3 objectRotation; = 45.0f;
matrix.loadIdentity ();
matrix.translate (objectCenter);
//apply transformations
matrix.rotateX (objectRotation);
matrix.translate (-objectCenter);
//it? work correctly until here
//when i try to translate the object to the real position, the rotation is incorrect.
matrix.translate (objectPosition);
I use C++, glm (to matrix manage) and OpenGL.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…