Just curious if there is any way to smooth out AI movement in blueprint. The default AI movement nodes don’t seem to have any ease in or ease out and only take actors or goal locations. I just wanted to ask here before trying to implement a custom solution. I’ve looked around but maybe I’ve missed a key piece of documentation. Thanks.
Bump. Anyone figured this out?
Smooth in what way? Rotation? Slowing down before reach a goal?
Yes, mostly an ease in and ease out. The default AI starts moving at a constant velocity and ends immediately instead of slowing down before the goal.
The best way I can think of to do this is to set the Max Walk Speed variable of the Character Movement Component to something lower the closer it gets to the goal.
An example:
Get the AI Actor location, a vector
Get the Goal Location, a vector
[Goal Location] - [Actor Location] = VectorA
Get the Length of VectorA (Blueprint has a function for this), this equals the distance between the two, (float)DistanceA.
Create a float variable called SlowDown, this will be the distance that you want the AI to start slowing down, possibly 512 units.
DistanceA / SlowDown and then Clamped 0.2-1 This gives you a float(SpeedMult) that is between 0.2 to 1 (I clamped it so that is never goes to 0 or above 1)
Every tick, set Max Walk Speed as NormalWalkSpeed(a variable you’ll have to create and set) * SpeedMult
This will give you a value that goes from 100% of the base walk speed to 20% the closer it gets to the goal.
You can do the same for an ease-in behavior by using the start point location and going from 20% to 100%.
I hope that all makes sense!
Ah, that’s a clever way to do it DSursely. I’ll have to give this a try when things slow down with work. Thanks for the suggestion.
this is something i would like to figure out too. I have an ai actor moving to random points (using this tutorial: A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums) and would like to add some easing in and out to the ai actor as it reaches each point. i tried to implement DSursely’s suggestion above with no noticeable difference (part of this attempt is at the bottom of my screenshot). Then i tried to use unreal’s ease function with no result. Obviously i’m not doing something right, most likely many things.
&stc=1in my continuing attempts at easing, i’ve gotten something that almost works. it has some mysterious results, which i would be interested in figuring out. In my last post, I was trying to use the built in ease function, which i know now needs some kind of timeline as the alpha input (very little info about the use of this function). Since my times are somewhat random, this would not work. so i went back to wiring an ease in/out as DSuresly suggested. Here is my setup:
&stc=1Both ease in and ease out work by themselves, but i haven’t figured out how to merge them. in theory, min and mult should work, but they don’t give me a percentage. i’m using the map to put the values returned to something usable. if anyone has any suggestions, please let me know.
Hope this may help: CharacterMovement -> Nav Movement -> Check “Use acceleration for paths” to avoid sudden brake
I Love you.
Easy: google search for the answer, here is my result UE4 - Make AI Rotate Smoothly (Avoid Snapping) - Dream Bot Studios
This solution works indeed for the MoveTo task. Only problem is that it breaks the character rotation for the “Set default focus” service