Speed up/slow down AI using a float curve?

Hi. I was wondering how I could increment and decrement the max walk speed of a character pawn.

So I basically have an AI which has a default max walk speed of 200. When the AI Perception sight is triggered, the AI sets the target to what it sees and sets max walk speed to 900. This works fine with the behavior tree but doesn’t look that great. I want to gradually increase its speed when its chasing the player and again, gradually decrease its speed as it comes closer to the player. I’m still kinda new to UE4 and not really experienced with using timelines and float curves.

Here are some screenshots of how I’m handling the AI currently:
The AI Controller:

Setting the target and increasing speed:

Simple Behavior Tree:

What would the best way to do this be? I appreciate any kind of help. Have a great day!

First of all, you need to have a look at any tutorial on get curve value

You don’t need a timeline, simple gate will be enough for this

When AI gets a signal that player was detected, open one gate where you gradually each frame increases its speed until maximum and then close this gate
If the AI gets lost the target opens the second node where you do the same but with speed decrement
Also, you need to close the gates in the process, if the target was lost before the maximal speed was achieved or for the opposite case

And to make gradual changes on speed value you need to use

1 Like

Hey mate, thanks for the info. I will take a look at these and post here if I can’t figure it out! Appreciate it. :grin: