How to gradually increase speed when moving forward

I’m working on a tank vehicle that I’ve built from scratch, currently when moving forward and backward the vehicle goes from 0 - desired speed instantly and feels very unnatural, I’m trying to figure out a way to increase/ decrease the speed over time but I can’t figure it out. I’m assuming it’s something to do with timelines.

Here’s my movement code.

Add a timeline, you can add a float track in the timeline and have that go from 0 to your desired speed over a specific amount of time.

Say your desired speed is 200. your timeline would look a little like this:

Remember to hit these buttons so that the timeline fits on the screen:
image

Here is a great video on how to do this: unreal engine 5 beginner timeline in blueprint with float and event - YouTube

Depending on the version of the engine you are using, the ‘float’ button he clicks can be found in the ‘+ Track’ button.

Another pretty simple thing is having 3 variables.
Accelleration Decelleration and Speed
You will move the tank using speed.

Input Forward will use an Accelleration of (5?) to increase speed
Whe no input is given the speed will be reduced by Decelleration(10)
Sure you will need to set a Max Speed to something and Minspeed 0 in some case


I’ve added in a timeline with some rough timings and tried setting it up but whenever I hit play the vehicle plays the timeline without any button presses and moves on its own

This sounds like it could work really well but I’m not too sure I know how to figure it out.

do you have to hit the button to make you go forward to make the vehicle practically go autopilot? or does it happen as soon as you hit play?

It happens as soon as I hit play, and I haven’t set the timeline to auto start

try removing the multiply pin, if it isnt that then, well, im clueless.

Hmm, nope it wasn’t that strangely. Thank you for your help though!

no problem.

What you dont know?

you may need to use the tick event to change the speed at every tick.
and in the tick event you will also reduce the speed if nothing is pressed.

I don’t know how I’d set that up, I can make the variables but I wouldn’t know how to connect them up to get the desired effect,

Just had a brain wave, have you tried using enhanced input? it may have some options to get the effect you are wanting.

No not as far as I know lol

they are a bit confusing to wrap your head around. it took me forever but. it was worth it.

It might be able to help you, as it has a scalar modifier:

Okay thank you, I’ll take a look

no worries, anytime.

Yeah no clue how to do that.