Mouse movement

How can I make the mouse move infinitly to a certain direction (so that it does not get stuck at the borders) and still be able to retrieve the coordinates.

I am going to use this for the view of the camera so when I move the mouse it must spin and spin and not getting stuck when the borders are reached.

Do not map the mouse coordinates directly to your rotation. Instead use an equation such that difference between cursorpos x or cursorpos y from center of window results in either a constant change in angle or small dist = small angular change, bigger dist = bigger angular change.

You can maped the mouse position.

Mouse is at center of screen no movement.

Mouse past X position, increase move++

Mouse below X position, decrease move–

Other option is with the mouse button.
mouse down read mouse until mouse up.

You have two variables, mouse down position and mouse up position.

mouse down position - mouse up position

If the result is negitive the move for forward if positive move was backwards.

Also you distance mouse traveled to get how much to move camera.

This help?

Originally posted by Muskov:
[b]How can I make the mouse move infinitly to a certain direction (so that it does not get stuck at the borders) and still be able to retrieve the coordinates.

I am going to use this for the view of the camera so when I move the mouse it must spin and spin and not getting stuck when the borders are reached.

[/b]

aha that might work, thx!

Hi !

If you are using “drag” operations (mouse button down while moving mouse) you can do SetCapture() when the mouse button in pressed, this will continue to give you mouse events even when you move outside the window, just remember to call ReleaseCapture() when you are done.

Mikael