mouse wheel event


20-07-2007 03:44:33

i know that OIS::MB_Left will respond to the left moust button event. if i want to respond to mouse wheel, what's state? I also try OIS::MB_MIDDLE. it didn't work. and if i scrool the wheel, how i decide whether i scrool down or up the wheel and then enlarge or descream the view?


20-07-2007 09:02:42

Sorry, these are OIS questions, and I don't know offhand. You should ask in the OIS forums, I believe it is


26-07-2007 15:28:16

Could be wrong, I only just wrote this code, but I'm basing it on some stuff I found online (don't have the URL any more, sorry):

this is for unbuffered input:

newZRel = Ogre::Real(mInputMgr->getMouse()->getMouseState().Z.rel);

if (newZRel != 0)

I believe that the Z value of the mousestate for the inputmanager (from the wiki 'Using OIS' page's 'InputManager' class) is the scrollwheel movement. For a scrollwheel click, of course, you just want the MB_MIDDLE event:

if (mInputMgr->getMouse()->getMouseState().buttonDown(OIS::MB_Middle))

kungfoomasta, feel free to slap me down if I'm mistaken. I haven't tested this code much yet!


26-07-2007 20:52:24

I believe that's correct. The Z field is used to determine if the mouse scroll wheel has moved forward or backward.

And the MB_MIDDLE looks correct also. Should set a breakpoint and test this to be certain. :wink: