AI pauses/stops moving shortly before going to next pathpoint?

I have made a behavior tree with a pawn(ai) moving on a spline from point to point.
But between every spline point there is a short moment the pawn stops moving before finding the next pathpoint.
Is there a way to make this go smoothly?

Below the BT and the tasks

Hey again @Bobsondo!

There isn’t really a way to do this effectively with points. You would need to use the spline path itself.

Honestly I don’t suggest using a behavior tree for this. You’d get better results from such simple activity from just using the AI controller/ Actor Blueprint. You COULD take a lot of the functionality and put it into a BTTask.

Here are some other threads with accurate methods of moving AI’s along a spline!

You should be able to get what you need from those. Hope that helps!

If you really want to get into it, there is also this sample project/write up on how to do these things:

Hey @Mind-Brain I will take a look into the links, thank you! :slight_smile:
The reason I want to use a Behavior Tree is that when the AI smoothly follows the path, I want the movement to interrupt when the player is to far away and play an animation until the player is close enough again.

But im going to try using the spline length / distance instead and see if that helps,

Thank you once again :slight_smile:

You need to use a service!

This is from:

Update;

This is the result I came up with but my character aint moving,
After 2 weeks I’m lost at what the issue could be…

Any help is much appreciated

This is what I want to achieve (with a behavior tree)

What’s inside of that task? That behavior tree is not really anything BUT that task, did you make it?

Ah I´m sorry, if you click the image there are 2 more below it,
It´s an album of 3 images, image 2 and 3 show the task

Oh, I’m sorry! My bad!

So looking here let’s go one thing at a time. You have this cast to AIC for some reason unknown as you are doing nothing “AS AIC Behavior Follow Spline”. What are you attempting to do here?

image

1 Like

Sorry I’ve been busy with work the past 2 days,
But I’m actually not sure myself if I did that part correctly at all.

I might also not have been very clear about my whole setup;
So what I have done;

  1. I made a spline path
  2. I made a basic character which must follow the spline
  3. I added an AI Controller (AIC) to the character to act as it’s brain
  4. I added an actor componement to the character that calls the behavior tree
  5. I added a BT & BB + a task

(see this image, it contains the setup + an overview of every componement)

In what you highlighted;
I didn’t do anything with the AIC because I figured I had to complete the cycle of calling the character.
But what do you suggest I should do there?

In the first part of the task I basicly want to determine the duration of the spline path based on the spline length and the character walk speed;
In the sequence ;

  • I call the spline length
  • I call the AIC > continues to the character of which I call the max walk speed;
    (I divide the spline length through the walk speed to get a “duration” value)
  • Than I call the custom event “run”

In the second part;

  • I call the AI controller (AIC) and connect that to a movement (because i thought the AIC controls the pawn now)
  • As destination I get the spline length + duration and trow that in a lerp, with the duration as the alpha
  • I set the lerp value as the distance I’ve walked on the spline and input that into destination.

Honestly the part you highlighted, I dont know what to do there, or if I even have to call the AIC there at all…

(I had the walking part working without a behavior tree and with a timeline, but I cant use timelines in tasks of behavior trees so I have to figure out something else)

If you see the whole scenario, am I doing something stupid?
I’m a bit inexperienced but trying to learn and I appreciate your help a lot <3

(edit after I posted this reply, I just removed that “call AIC”, I don’t see the reason to do that either)
So this is the new part 1 of the task;

You know what, I had an idea.

It’s working, for the most part. You’re learning (as we all still are!) so once it works figure out how to refine it and that’s what you’re needing right now. So let’s put a pin in all this for a moment.

This is for an NPC, so braking isn’t as important. This might give you the overlapping movement you need-

Try opening your character movement component and messing with the BRAKING setting on your walk. If the braking is turned way down it may try to slow down early, if that’s the case you could tune acceleration as well.

Also- most of the stuff you mentioned in this previous post is true. I don’t think I’ve ever added a custom component for AI though… HOWEVER there are so, so many ways to do things with UE5 and that’s part of the appeal!

Mess with the braking and acceleration and lmk how it goes!