Character acceleration over time?

Hello everybody!
I’m a complete noob trying to make my a race-run game with blueprints. So i want to make my character act like a vehicle: button pressed - he starts running and accelerating over time; button released - character starts to slow down. And also im going to parametrize starting speed&acceleration so there would be several runners with different stats.
I am aware of basic maths like velocity=acceleration*time. The question is, which nodes should i plug these parameters into? I tried to add it into “add movement input” - no result. Tried to create curve and plug it into “Ease” node - had no idea how to plug curve in Ease alpha.
I even tried to create curve inside the timeline - still nothing.
I cant understand what am i missing, any suggestions, please?

Here are some screens of my attempts.



Greetings @GreenOk.1 !

Welcome to the Unreal Engine community! :medal_sports:

Just so you’re aware, this topic has been moved from the International forum category to the Programming & Scripting - Blueprint forum category. I added the optional tag “Blueprints-Programming” for you.

Just remember, when posting, please review the categories to ensure your topic is posted in the most relevant space.

Wishing you the best of luck in your game dev journey,

Your Friendly Neighborhood Moderator :smiley:

1 Like

Hey @GreenOk.1! Welcome to the forums!

Are you using a character or a vehicle? The character should come with “CharacterMovement” component, and within that component you can actually set your acceleration speed!

You can also drag the component into your graph to set it to different values during play.

image

Yeah, it kinda worked, thanks! I used character movement component to set max walk speed and used a timeline curve to set “over time acceleration”, but now i got another problem - my character stops as soon as timeline reaches its end. How should I keep the movespeed value even after the timeline ends until the button is released? Maybe there is a way to make some sort of infinite timeline where the float reaches max value and keeps up until the button is released?
Thank you for your help very much!

1 Like

I finally managed to solve the problem - simply separate the inputaxis key and speed change during timeline, but I still got have one question left!
How do i get the InputAxis key so i dont need to set up “W key” event, so if the player will change the input bindings, the event, starting the timeline would change as well?

1 Like

Question solved, thx for helping with character movement!
For those with the same question: just found out that axis mapping outputs the float continuosly, so i just used the branch to check if it is pressed or not.

2 Likes