I'm curious on how people added side stepping (or strafing) in to their programs. I figured out how to move around relative to the heading, and figured the side stepping would be easy to figure out based on the heading, but i'm having trouble.

I thought the side stepping (page up/page down keys) would have the zpos and xpos switched because of the strafing path being the perpendicular of the current heading. Well it works, but only for multiples of pi/2 headings. So what's wrong with the way i'm figuring out the side stepping?Code:glTranslatef(xpos,jump,zpos); //.... later in the code if(keys[VK_UP]) { zpos+=0.15f*cos(lookdir*pi/180.0); xpos+=0.15f*sin(lookdir*pi/180.0); } if(keys[VK_DOWN]) { zpos-=0.15f*cos(lookdir*pi/180.0); xpos-=0.15f*sin(lookdir*pi/180.0); } if(keys[VK_NEXT]) { xpos+=0.15f*cos(lookdir*pi/180.0); zpos+=0.15f*sin(lookdir*pi/180.0); } if(keys[VK_PRIOR]) { xpos-=0.15f*cos(lookdir*pi/180.0); zpos-=0.15f*sin(lookdir*pi/180.0); } if(keys[VK_LEFT]) { lookdir+=0.25f; } if(keys[VK_RIGHT]) { lookdir-=0.25f; }

Then for banking, i want the camera, or viewport to tilt to the side (kind of like the screen is looking around a corner), but can't come up with a good approach to doing this. I thought I could tilt the entire "world" so to speak, but thought I'd have to rotate every object within the "world", and that seemed time consuming. Any ideas?

Im using codeblocks with OpenGL.