I’m working on a 3d Scene, Now becoming a 3d Enviroment scene. I am working on key input.
I have succesfully implemented movement on the means of the Z, and X axis.
Forward
Left/Right
Reverse
But now I want to implement a means of rotating. Rotation on the “Y” Axis.
To set the appearance of “Turning” in a direction. Well, I tried
glRotatef(Z,0.0f,1.0f,0.0f);
where the int “Z” is Increased/Decreased by 0.3f upon the single touch of a button.
Well, it worked kind of. The Rotation works. But the Forward,left,right,reverse keys get mixed up. Along with Rendered objects, (walls and a cylinder to be exact) I am unsure. But is this the correct approach? Or is it a simple mathamatcal and/or OpenGL function misuse error?
Remember that when you rotate you also rotate your coordinate system so future calls are about this rotated coord system. look at push and popmatrix as well as loadidentity.