PDA

View Full Version : Infinite mouse rotation


iko
07-04-2007, 01:19 AM
hi,

i currently develop with an openGL engine
my problem is how to have an infinite rotation for the mouse : when the mouse reaches the border of the screen this wont rotate anymore my 3d view
i have tried to set the cursor position after a rotation, but .. this rotates back to the previous position my 3d engine
any clue welcome

Sol_HSA
07-04-2007, 01:50 AM
You need to capture the mouse and track the mouse relative motion instead of absolute position..

iko
07-04-2007, 01:57 AM
when i rotate my camera i do so with a relative position to calculate the angle of rotation
my main problem is that when i reach the border of the screen i have no more rotation of the mouse, its position is stucked
is there any way to declare to windows you want your mouse to move unbound ?

Sol_HSA
07-04-2007, 02:08 AM
If you're using SDL, it does all that for you, and you can just check the relative positions.

If not, I don't remember if windows returns relative positions somehow..

One workaround is to move the mouse cursor to the center of the screen on each frame, but that's not too neat =)

iko
07-04-2007, 02:13 AM
yup i tried to move the mouse back on each move, but if i set the new mouse cursor position by using SetCursorPos this is considered as a new input by my 3D engine and so this rotates back my camera, gasp

iko
07-04-2007, 02:33 AM
ok found it, i simply avoid any callback from some mouse drag and then dont care about the boomerang effect, i just pickup on each refresh the current mouse pos, rotate my camera considering the delta with the original mouse position (i get it when i click down the mouse) and reposition my mouse then. finaly easy. thanks for your inputs Sol_HSA :)