
direction in directx
i'm writing a first person perspective demo in directx 8, and i was wondering if anyone could give me any ideas on how they go about finding out which direction the user is facing...right now, if the user presses the up key, i increment both Z axis coordinates, etc, so the user "walks" forward. but if they turn and press up, there is an obvious problem...can anyone tell me the best way to know which way they are facing and also which axis' to increment/decrement based on this direction? thanks!

You can set up a translation matrix for the amount of zaxis units moved. Set up a rotation matrix for the amount of yaxis rotation. Multiply these two together and translate your View Translation matrix by the result. This code updates the view matrix by the change in xaxis,zaxis and y rotation (strafing,walking backwards/forwards and turning) 
D3DXMATRIX rot_view;
D3DXMATRIX tran_matrix;
z=z1;
x=x1;
r=r1;
D3DXMatrixTranslation(&tran_matrix,x,0.0f,z);
D3DXMatrixRotationY(&rot_view,r);
D3DXMatrixMultiply(&tran_matrix,&rot_view,&tran_ma trix);
D3DXMatrixMultiply(&view_matrix,&view_matrix,&tran _matrix);
x1 = x;
z1= z;
r1=r;
This assumes you already have your View Translation matrix set up in the D3DXMATRIX view_matrix and that x,z and r are the total amounts to translate/rotate and x1,z1 and r1 are static variables.