Jump to content


Infinite mouse rotation


5 replies to this topic

#1 iko

    New Member

  • Members
  • Pip
  • 5 posts

Posted 04 July 2007 - 08: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

#2 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 482 posts
  • LocationNowhere whenever

Posted 04 July 2007 - 08:50 AM

You need to capture the mouse and track the mouse relative motion instead of absolute position..
http://iki.fi/sol - my schtuphh

#3 iko

    New Member

  • Members
  • Pip
  • 5 posts

Posted 04 July 2007 - 08: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 ?

#4 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 482 posts
  • LocationNowhere whenever

Posted 04 July 2007 - 09: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 =)
http://iki.fi/sol - my schtuphh

#5 iko

    New Member

  • Members
  • Pip
  • 5 posts

Posted 04 July 2007 - 09: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

#6 iko

    New Member

  • Members
  • Pip
  • 5 posts

Posted 04 July 2007 - 09: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 :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users