Enhanced input Player Speed On Mouse Scroll Wheel

Hi all,

I’m trying to implement a feature where the character’s movement speed is adjusted using the mouse scroll wheel in Unreal Engine 5.5.1, and I’m using the Enhanced Input system.

I’ve created an Input Action (IA_AdjustSpeed) I’m struggling to properly update the character’s movement speed based on this input, I think I have it set up right?

Here is a picture of my Movement/Sprinting system for more clarity, I cant tell what I’m doing wrong here.

Hey @Touka01! I’ve also implemented the same mechanic in the past :star_struck:

So what you need to do is to create an input action and set it’s value type as Axis 1D (float) like this:

Screenshot 2025-01-10 174223

Then from the Input Mapping Context, bind it to the Mouse Wheel Axis like this:

Screenshot 2025-01-10 174242

Then set up your character blueprint’s Event Graph like this:

In my blueprint code above :point_up: the default value of my variable named “Calibration” is 25. You can set it’s default value along with the min & max values of the clamp node to your liking.

And here’s the result:

Now you can increase the speed by scrolling the mouse wheel up and decrease it by scrolling down!

Hope this helps :innocent:

1 Like

Hi, thanks for taking the time to look at this, unfortunately I am still running into the same issue, nothing really seems to happen even after I tried what you suggested, here are the screenshots from what I edited.

I am not sure what the issue is

(sorry for the multiple replies as new users can only attach one attachment per reply :confused: )

Can you:

  • Check if the input action does indeed get triggered? (Which you can do by hitting F9 while the node is selected. The game should be paused when you scroll the mouse wheel.)
  • Confirm that the default value of your variable named “Speed Increment” is not 0?
  • Share your character’s default max walk speed?
  • Print the velocity’s magnitude (which you can get by using the Get Velocity node and using the Vector Length node to get it’s magnitude) every tick and see what happens?

Btw probably that’s not the case, but you weren’t scrolling the mouse wheel up when the character’s current speed is already the max value of our clamp, right?

thank you again for taking the time to look at this, so it seems like my logic for not letting the player sprint backwards or sideways and is whats preventing the mouse scroll wheel speed adjustments, when I switched it back to IA_Sprint → Start Sprinting and Stop Sprintingm everything worked fine, but I want to keep that same logic with the new mouse scroll wheel and I can’t wrap my head around why it wouldn’t be working, here is how its setup currently:

Alright! So here’s the whole thing

Sprinting:

The default value of my variable named “Boost” is 250. Again, you can adjust it’s default value to your liking as well.

IA_Move: (You can have more than one IA so below is not the entire IA Move of course)

As I also noted in the image, if you add forward movement input with action value’s X component, or you don’t swizzle the forward movement key (W), you’d need to use the Action Value X pin instead.

Hope this helps! :blush:

That definitely gave a lot of insight so I really appreciate it! (though it will take me time to figure everything out il keep you updated)