Forward movement strength based on time pressed

Hi, Im kinda new to Unreal and I`m confused on how to make my character go forward based on the amount of time that I press the key. The idea is that you get more forward strength the longer you press the key, but you get that inpulse once you stopped pressing the key.
I will leave a picture of what I have in my Character Blueprint, but its probably not close to what I want. I am also not sure if I should use a Input Axis or an Inpuit Action for this.
Also, how can I make it so that the time pressed has a limit? So that the max amount of strength has a limit.


2

Hey there @ElSopero! Welcome to the community! So movement acceleration is actually already built into the character class, so technically you could use that system by increasing the max player speed and adjusting the acceleration during the boost.

image

Or if you’d like to handle it yourself for more curve based control of a speed ramp up you could use a timeline:

Though depending on if you’ll have other speed modifiers, modifying the speed directly isn’t always the right move. Timeline is also not strictly necessary, you could also just increase or decrease max walk speed on tick and clamp it at the maximum you’d like.

2 Likes

The new enhanced input system also has an elapsed seconds held pin. This can be used to drive a lerp float to add to the character movement.

4 Likes

Hey! Thanks a lot for your answer, it made me discover menus I didn`t knew about haha. Before I read you message, I was able to figure a way to make it work as I wanted. I will leave a picture attached.
Still something weird happened. I was changing and testing the different settings in CharacterMovement when suddenly Unreal crashed and now I cant modify anything of it since the details panel for the BP_Character are incomplete and the Root Component (including its child components) are not showing any details panels as you can see in the picture. I guess I have to create a new Blueprint? Or is there something more to it I dont know? Thanks a lot!

Thanks for the answer, I will definetly check this method in the future! Before I read your message I got a setup that works, I will leave a picture attached.

Oh that’s not great, there could be an issue with the BP itself from the crash. Does the issue occur across all BPs or just the one you had open during the crash?

No, only with that Blueprint. And it happened for a second time again, its basically when Im changing those values from the character movement and compiling, something stops working properly. Its annoying honestly, do you have anything in mind that can be causing it? Im on 5.3, maybe I should change?

Could I take a look at the crash logs? You can find them in the Saved/Crashes and Saved/Logs. The log itself will be named after your project.

Im not sure what exactly you need but here are the text from 3 different crashes:




Thanks a lot for your time and help btw! :smiley:

Judging by the errors, back everything up first, it seems that the BP might be corrupted. I’d check in your Saved folder for the Autosaves and replace the BP with the saved version of there.

1 Like