   what to do with the mouse pointer in an FPS camera?
  hi, you all know the camera mode in an first person shooter.now i am currently having problems what to do with the mousepointer.if i dont do anything at all, it happens that the pointer goes outside the window and movement will stop.if i fix the mousepointer somewhere inside my window, i cant look around, since the difference doesnt work anymore:every frame i do:lookamount = mousepposition - lastmouspositionthanks   
  After the User moves the mouse, measure the difference it moved. Then put it back in the center of the screen.Keep a running total of the difference each time it moves, so you can know where it 'should be' even though the real cursor keeps getting recentered.   ;  The problem is that, when you move it back, you get another mousemove message, which negates the first mousemove. The solution is to keep a flag for whether you are recursing in your message loop or not.Or you can use the RAWINPUT stuff, which gives you raw mouse mickeys. You still need to set the pointer back to the center of the window, but you don't need to worry about the recursion.Something like this (didn't compile it, so watch out for typos):  ...  case WM_MOUSEMOVE:    if (!recursionFlag) { deltaX = MOUSE_X(wParam) - 400; deltaY = MOUSE_Y(wParam) - 300; recursionFlag = true; POINT pt = { 400, 300 }; ::ClientToScreen(hWnd, &pt); ::SetCursorPos(pt); recursionFlag = false;    }    break;  ...;  Hi,I think you want to grab the mouse input - which restricts it to your game window.  There are various ways of doing it depending on your platform and any utility libraries you are using.E.g. SDL_WM_GrabInputhttp://www.libsdl.org/cgi/docwiki.cgi/SDL_5fWM_5fGrabInputI guess see MSDN or try Google if you are not using SDL.Cheers,dhm   ;Quote:Original post by hplus0603The problem is that, when you move it back, you get another mousemove message, which negates the first mousemove. This is going to be API specicifc... butyou could always disable the mouse interrupts before doing the recenter and reenable them afterwards.I believe my solution, was to check if the absolute position of the cursor was the center of the screen after a move, in which case I ignored it. This works because the user cannot ever move the mouse To the center, only away from it; since the cursor starts out there every update. Thus the only moves that get ignored Must be the recentering ones.   ;  thanks everyone!hplus: "The problem is that, when you move it back, you get another mousemove message, which negates the first mousemove."that is exactly my problem, which results in the camera jumping back to its original view every other frame.hplus, your solution sound most reasonable, although it didnt work. maybe because i use java and i set the cursor via java.awt.Robot.mouseMove().haphazardlynamed, your solution seems to work, but the movement is quite stuttery. it feels like the camera is shaking a little bit.   ;Quote:Original post by ehmdjiihaphazardlynamed, your solution seems to work, but the movement is quite stuttery. it feels like the camera is shaking a little bit.Is this for the disable interrupts method?or for the ignore center moves method?I remember that the first method can sometimes stutter, depending on if/how interrupts are queued, whether they get flushed during the disable/enable process, and other Specific factors...The second method, I dont recall ever having problems with though...So if you're getting problems with this one I'm not too sure at the moment... Make sure that you only do a Recenter Cursor move when absoultely necesarry; I made a mistake when first doing this and recentered on Both cases UserMove and IgnoreMove, thus I was overloading the event stack with mousemotions and the thing got slow and jerky...   