How to detect mouseWheel control


(Bora Kasap) #1

How to use mouseWheel & mouseWheelDelta? I’ve tried something but i can’t understand how it works?

I’ve a variable “X” and i want to increase and decrease it by mouse wheel control, how to do this?


(Jacob Albano) #2

mouseWheel is true if the wheel was scrolled this frame. mouseWheelDelta is the number of lines that were scrolled.

So you could do this:

if (Input.mouseWheel)
{
    x += Input.mouseWheelDelta;
}

I believe if the wheel wasn’t scrolled than the delta will simply be 0, so this might work the same way:

x += Input.mouseWheelDelta;

(Bora Kasap) #3

Ah thanks, got it now.

I was thought it like: Input.mouseWheelTurning

But it is just a: Input.mouseWheelTurned

Thanks again.