Original Post
I am trying to stop my camera from rotating to far up and down and can't get this to work... Thanks
if(rotate)
{
GetCursorPos(&mousePos);
unsigned int x = unsigned int(screenwidth * .5f);
unsigned int y = unsigned int(screenheight * .5f);
static float lastPitch = 0.0f;
static float currentPitch = 0.0f;
SetCursorPos(x, y);
float pitch = directInput.mouseDY() / ROTATEMOUSE_SPEED;
float yAngle = directInput.mouseDX() / ROTATEMOUSE_SPEED;
lastPitch = currentPitch;
currentPitch += pitch;
if(currentPitch > pitchRangeMax)
pitch = pitchRangeMax;
if(currentPitch < pitchRangeMin)
pitch = pitchRangeMin;
D3DXMATRIX R;
D3DXMatrixRotationAxis(&R, &mRightWS, pitch);
D3DXVec3TransformCoord(&mLookWS, &mLookWS, &R);
D3DXVec3TransformCoord(&mUpWS, &mUpWS, &R);
D3DXMatrixRotationY(&R, yAngle);
D3DXVec3TransformCoord(&mRightWS, &mRightWS, &R);
D3DXVec3TransformCoord(&mUpWS, &mUpWS, &R);
D3DXVec3TransformCoord(&mLookWS, &mLookWS, &R);
}