In the following code fragment, FORWARD and BACKWARD work perfectly but LEFT and RIGHT only work properly when the angle is 0, PI/2, PI, 3PI/2 or 2PI. Another thing I noticed is that when the angle is PI/4, 3PI/4, 5PI/4 or 7PI/4 and I hold down FORWARD and LEFT or BACK and RIGHT the camera strafes left and right properly. I am useing a fixed cordinate system with the camera moving parallel to the x and z plane.
switch (key)
{
< >case FORWARD:
< >cameraz -= cos(angle);
< >camerax += sin(angle);
< >glutPostRedisplay();
< >break;
< >case BACK:
< >cameraz += cos(angle);
< >camerax -= sin(angle);
< >glutPostRedisplay();
< >break;
< >case LEFT:
< >cameraz += sin(angle);
< >camerax -= cos(angle);
< >glutPostRedisplay();
< >break;
< >case RIGHT:
< >cameraz -= sin(angle);
< >camerax += cos(angle);
< >glutPostRedisplay();
< >break;
< >default:
< >break;
}