I'm new here and I have a silly question to start off.
I have a simple program that draws a cube. You can rotate the cube with arrow keys and look around on one spot with the camera.
Now I've been messing around with it, thinking wouldn't it be fun to make a 360 degree turn and get back to my cube.
What the program instead does, is keep going infinitely in the direction I choose and it will take the same amount of moving the mouse to get back to the object (hence, it never makes a 360 degree turn).
So, the impression this left me is that direct3D thinks that there is an infinite amount of space or something along those lines.
Almost like every 360 turn is on a next level and to get back to the object, you need to turn around enough times to get to the level the object is at.
Anyway, enough fantasy, here's the code:
D3DXMATRIX matView; // the view transform matrix static float LookX = 0.0f; LookX -= mousestate.lX * 0.0075f; static float LookY = 0.0f; LookY -= mousestate.lY * 0.0075f; D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3 (0.0f, 0.0f, 15.0f), // the camera position &D3DXVECTOR3 (LookX, LookY, 0.0f), // the look-at position &D3DXVECTOR3 (0.0f, 1.0f, 0.0f)); // the up direction d3ddev->SetTransform(D3DTS_VIEW, &matView); // set the view transform to matView
What should I do to fix this problem? I'd rather not start guessing on my own this time, but if I should stay vague, then I think I would probably need to do some checks on the LookX and LookY values??
I'm using directX 9 and Visual studio 2008