MOvement wiht camera

I have gotten a camera to wokr and I had
the function to move correctly, but it the camera was not staying on the floor:

 /*Mouse View Events*/
	void glCLeft() {m_angle -= 1.5f; }
	void glCRight() {m_angle += 1.5f;}
	void glCUp() {m_height += 1.5f;}
	void glCDown() {m_height -= 1.5f;}

	/*Keyboard movement events */
	void glCMLeft() {camerax += 1.0f;}
	void glCMRight(){camerax -= 1.0f;}
	void glCMUp()   {cameraz += 1.0f;}
	void glCMDown() {cameraz -= 1.0f;} 

Whereas the Render:

void System::Render()

	// clear screen and depth buffer

	// load the identity matrix (clear to default position and orientation)

glRotatef(m_height, 1.0f ,0.0f ,0);
glRotatef(m_angle, 0.0f ,1.0f ,0);
glTranslatef(camerax * SINE(m_angle),cameray, cameraz * COS(m_angle));

/*Draw floor*/
glBindTexture(GL_TEXTURE_2D, m_textureObjectOne);


And COS and SINE are defined as:

#include <math.h>
#ifndef __GL_COMPONENT
#define __GL_COMPONENT

#define PI           3.14159
#define TWO_PI       PI*2.0
#define HALF_PI      PI/2.0
#define SINE(x)      (float)sin((PI/180.0f) * x)
#define COS(x)       (float)cos((PI/180.0f) * x)

When I preass ‘A’ or ‘D’ to strafe, it moves on its original X Y axis, not the one I am loking at.
Can I get help?


Oh yeah, one more thing. This also happens when I want to ‘move’ not strafe, up. ‘W’ and ‘S’

Because you are straffing in World Coordinates not in Camera Coordinates, so it doesn’t matter where you are looking at, it will always move on the fixed X,Y and eventually Z axis (Albeit this might be what you want for Z).

To move on Camera Coordinates transform your displacement vector (say, -1,0,0 for left, 0,1,0 for front, or whatever convention you choose) by the inverse of the camera transformation matrix.

…huh? Can I get an example of some sort?

Fixed it 0_0
All I did was:

float camerarot = 360.0f - m_angle;
glTranslatef(-camerax, cameray, -cameraz);

I donot know why that made it work though >>
I think it is know going of the basis of 360 degrees, which alows it to move in a circle.
Thnaks for the help though! ^