Add Movement Input - Mousewheel

Hello Forum,

I have a Blueprint class called TEST, with a “Default Pawn” as parent. It is controlled by a Blueprint class with a “Player Controller” as parent. So it does not have an “AI Controller”.

I move it around with functions like “Add Movement Input”, which works fine.

The only thing I can’t get to work, is to change the height of TEST with the mouse wheel. If I use “Add Movement Input” (along the Z-axis), the movement is way too small / slow. I can’t temporarily change the movement speed, because Unreal Engine does that stuff with events:

  1. Increase movement speed.
  2. Call “Add Movement Input”. Triggers an event.
  3. Reset movement speed.
  4. Code is executed by event. Increasing movement speed had no effect.

Right now I am using “Add World Offset”, but then it jumps to the location. I would like it to move to the location.

Is there a simple way to tell TEST to move to a specific location? All AI controller functions (like “Simple Move To Location”) have no effect.

Thanks,

With the context you provided in mind, I think you mean you wanna control the speed of the character with mouse wheel. If that’s your objective, you can check out this post of mine :blush:

If you want to have an automatic movement feature for the player character, you can create a timeline, put the Add Movement Input node after it’s Update pin and call it with a custom event by connecting it to the Play from Start pin. You can also set the speed to your liking before triggering the timeline, right after the custom event. And to reset the speed once the auto movement is completed, you can simply set the max walk speed (that you drag out from the movement component) to your desired value.


You can subtract the actor’s location from the target location, normalize the result with the Normalize node, and plug it into the World Direction pin of the Add Movement Input node.

Hope this helps! :innocent:

1 Like

With the context you provided in mind, I think you mean you wanna control the speed of the character with mouse wheel. If that’s your objective, you can check out this post of mine :blush:

Hi, I don’t want to change the speed. I want to move TEST along the Z-axis (change height).
Every tick of the mouse wheel should move the character a certain distance. This distance currently too low and I can’t change it.

If you want to have an automatic movement feature for the player character, you can create a timeline, put the Add Movement Input node after it’s Update pin and call it with a custom event by connecting it to the Play from Start pin. You can also set the speed to your liking before triggering the timeline, right after the custom event. And to reset the speed once the auto movement is completed, you can simply set the max walk speed (that you drag out from the movement component) to your desired value.

I’ll look into that. But I can’t temporarily change the movement speed. What if TEST is changing height and moving in a direction simultaneously? Then both their speed would be increased.

You can subtract the actor’s location from the target location, normalize the result with the Normalize node, and plug it into the World Direction pin of the Add Movement Input node.

The input for “Add Movement Input” is not a problem. It’s just that you can’t change how far it should move per single input (single tick of the mouse wheel).

Thanks for the response!

Hey @Pupuludupu!

In that case, first you need to set the movement mode to flying like this:

Screenshot 2025-01-16 211442

(You can access this setting by clicking on the Character Movement Component on the Components window at the top left, and then navigating to the Details window at the top right while having it selected.)

With the movement mode set as flying, the character will slide by default. To prevent that, simply set this setting of the movement component to a very high value like this:

Screenshot 2025-01-16 215641

Once that’s done, you could trigger the vertical movement like this:

But:

Like you said, because one scroll of the mouse wheel is not continuous unlike a button press, we’d need to keep triggering the vertical movement for a little bit on every momentary input like this:

Double click on the timeline and set the length to a very small value like this:

Screenshot 2025-01-16 213821

To adjust the intensity of each scroll, you can adjust the Breaking Deceleration Flying that we already went over or the Max Acceleration here:

Screenshot 2025-01-16 214912

Though keep in mind that you’ll see the affect of this setting on the horizontal movement as well. And no, multiplying the Action Value of the IA won’t work. So there really isn’t a way to adjust the intensity of the input without affecting anything else.

As I explained earlier, binding a mechanic that’s supposed to be continuous to the mouse wheel would cause such issues due to it’s nature. I’d recommend using the E & Q keys or the mouse forward & back buttons for that purpose.

The movement component handles that :blush: Even if you use separate IA’s for movement with separate Add Movement Input nodes for each, the character’s max walk speed won’t be exceeded on diagonal movement!

With that being said, the movement component actually has a behavior which is enabled by default, that speeds up the character on slopes. You probably didn’t even notice that but I think you’d also want that disabled. To disable it, you can uncheck this checkbox that you can find under the details of the movement component:

Screenshot 2025-01-16 211505

Hope these help!

1 Like

You da man! Timeline was exactly what I was looking for. Thanks!

1 Like