ok i got the camera and the mouse to work but i have another problem hehehehe
now the wasd button won't work with properly, the camera won't move in the direction it is headed, it pans in the x and z axis but won't 'head' in the direction the camera is facing
here is my code for the WASD
Code:
if (keys['W'])
{
camera_x -= (float)sin(direction * piover180) * 0.05f;
camera_z -= (float)cos(direction * piover180) * 0.05f;
}
if (keys['S'])
{
camera_x += (float)sin(direction * piover180) * 0.05f;
camera_z += (float)cos(direction * piover180) * 0.05f;
}
if (keys['A'])
{
camera_x += (float)cos(direction * piover180) * 0.05f;
camera_z += (float)sin(direction * piover180) * 0.05f;
}
if (keys['D'])
{
camera_x -= (float)cos(direction * piover180) * 0.05f;
camera_z -= (float)sin(direction * piover180) * 0.05f;
}
where direction = mouse_y = LOWORD(lParam);
here isthe code for how the transformation is applied
Code:
GLfloat position_x = -camera_x;
GLfloat position_z = -camera_z;
GLfloat world_rotate = 360.0f + mouse_y;
glRotatef(mouse_x, 1.0f, 0.0f, 0.0f);
glRotatef(world_rotate, 0.0f, 1.0f, 0.0f);
glTranslatef(position_x, -height, position_z);
I think I have to do some trig maths to figure this out.