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?
In my blueprint code above 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!
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.
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:
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.