I'm experimenting with the MD2 Animation tutorial from www.gametutorials.com and have this object called g_3DModel, any idea how to rotate it, move it, etc?
Printable View
I'm experimenting with the MD2 Animation tutorial from www.gametutorials.com and have this object called g_3DModel, any idea how to rotate it, move it, etc?
Use glRotate3f(), glTranslate3f(), etc.
glRotate*() and glTranslate*() functions modify the location of objects in the world relative to a stationary camera. So instead of moving the actual camera around the world, it will move the world around the camera. If you wanted this same effect but on the camera you would use the gluLookAt() function. The following code is an example from my book to help explain this more:
When u picture this in use, imagine being in the piolet seat.Code:void PlaneView(GLfloat planeX, glfloat planeT, GLfloat planeZ, GLfloat roll, GLfloat pitch, GLfloat yaw)
{
//roll is rotation on the z axis
glRotatef(roll, 0.0f, 0.0f, 1.0f);
//yaw (heading) is y rotation
glRotatef(yaw, 0.0f, 1.0f, 0.0f);
//pitch is rotation on x
glRotatef(pitch, 1.0f, 0.0f, 0.0f);
//move the plane to the planes world coordinates
glTranslatef(-planeX, -planeY, -planeZ);
}