# Need Help With Basic Camera

Hi, I am having some serious issues with a camera in opengl and I am hoping someone can help. Here is my code for the camera

``````//W
if(camInput->DigitalControlMap)
{
yrotrad = (yrot / 180.0f * M3D_PI);
xrotrad = (xrot / 180.0f * M3D_PI);

camInput->DigitalControlMap =false;
}
//S
if(camInput->DigitalControlMap)
{
yrotrad = (yrot / 180 * M3D_PI);
xrotrad = (xrot / 180 * M3D_PI);
camInput->DigitalControlMap =false;
}
//A
if (camInput->DigitalControlMap)
{
yrot -= 0.01;
if (yrot < -360)yrot += 360;
camInput->DigitalControlMap =false;
}
//D
if (camInput->DigitalControlMap)
{
yrot += 0.01;
if (yrot >360) yrot -= 360;
camInput->DigitalControlMap =false;
}
M3DMatrix44f testx, testy, trans, cam,test3;

m3dRotationMatrix44(testx, xrot, 1.0, 0.0,0.0);
m3dRotationMatrix44(testy, -yrot, 0.0, 1.0,0.0);

m3dTranslationMatrix44(trans, -xpos, -ypos, -zpos);	//Create A Translation Matrix

m3dMatrixMultiply44(test3, testx, testy);			//Multiply The Two Rotations Together

m3dMatrixMultiply44(mCamera, test3, trans);		//Now Multiply the translation and rotation
``````

I am trying to move away for glRotatef and such like but the problem with this code it you never really move forward. Instead you move along the same axis no matter which way the camera is facing. The rotation works fine, I just cant figure out why I wont walk in the direction that you are facing.

EDIT: if the test3 and trans are transposed to give “m3dMatrixMultiply44(mCamera, trans, test3)” then you move forward in the right direction, the only problem now is it always seems to rotate around a certain point and not where you are currently standing