- Home /
Using the scrollwheel
I am using the scrollwheel to change weapons in my game, and was wondering if there was a way for it to recognize which way the scrollwheel is turning. Any help?
Answer by homeros · May 27, 2011 at 07:45 AM
Input.GetAxis("Mouse ScrollWheel");
returns negative when scrolling down and positive when scrolling up
Hmmm, I am using this at the moment: if ( Input.GetAxis("$$anonymous$$ouse ScrollWheel")) { gunnumber++; } How could I make this go up or down?
use it like this: if(Input.GetAxis("$$anonymous$$ouse ScrollWheel") > 0) { gunnumber++; } else if(Input.GetAxis("$$anonymous$$ouse ScrollWheel") < 0) { gunnumber--; }
but this will increase your gunnumber too rapidly. You probably would like to lock it for some time so it's incremented or decremented once.
Your answer
![](https://koobas.hobune.stream/wayback/20220612090353im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Move FPS up/down one level in a building 1 Answer
FPS animate camera look up/down 0 Answers
Moving a object up and down 2 Answers
using Raycast.hit function my car gets up and doesnt get down ? 0 Answers