Original Post
Hey ive been working on the controls for a simple FPS and i got stuck on trying to create strafe using the D and A keys, below is an example of how i done the regular backwards movement:
if( ::GetAsyncKeyState('S') & 0x8000f )
{
D3DXVECTOR3 vDirection;
D3DXVec3Normalize(&vDirection,
&(target - pos));
pos -= vDirection * (TimeDelta * 4);
D3DXMatrixLookAtLH(&V, &pos, ⌖, &up);
}
This worked perfectly but i couldnt figure out how to translate the eye position to the 'right', i read that to create a 'right' vector you have to cross the 'up' vector with the 'look' vector which ive done, but after that im lost:
if( ::GetAsyncKeyState('D') & 0x8000f )
{
D3DXVECTOR3 vRightStraffe;
D3DXVec3Cross(&vRightStraffe, &up,⌖);
pos += vRightStraffe * (TimeDelta * 4);
D3DXMatrixLookAtLH(&V, &pos, ⌖, &up);
}
So can anyone point me out where im going wrong, as allways its appreciated.