How to use mouse wheel as input?

Hi!

I’m trying to figure out how to work with mouse wheel. I have defined this in the project settings:

imagen

And this is the code:

The function InputAxis ZoomOut is always triggering with AxisValue = 0.0, and the Mouse Wheel Up triggers only when I move up the wheel.

I’ve done this project to test it before move everything to C++, and I don’t know if there is a function Mouse Wheel Up in C++.

How can I use the mouse wheel up and down?

image

image

It makes sense that the axis value is 0 because the scroll wheel acts more like a button (a single movement up or down) after which it rests and does nothing. Unlike a joystick, you can’t “hold” a mousewheel into a direction.

You should add the ZoomIn and ZoomOut as ActionMappings. Every time one of these events executes, you should call DoZoom() with a constant up or down float value, which adds or subtracts from a stored target value you want to zoom towards.

Here is my approach - it might help you

1 Like

Seda is correct, mouse wheel input is digital, it is treated as a button.

Thanks for your answer.

How can I add a constant value (node) to the blueprint graph? For example, the value 1.0 or -1.0.

I’ve been searching about how to do it but I can’t find anything.

Thanks.

This can be boiled down to a single event, no additional Gates or Tick needed:

How can I a constant value to the blueprint graph? For example, the value 1.0 or -1.0.

Not sure why you’d need this but, to answer literally, you could:

Or:

Or:

image

But that’d be quite awkward to use unless you’re after some specific behaviour, of course. Who knows.

3 Likes

Thanks, I wrote this part early on the start of my UE journey :slightly_smiling_face:
Compare Float node feels promising, will rewrite this piece