Make AI continuously follow player (Behavior Tree)


I have an AI character, which should continuously follow player.

His behavior tree looks like:

  1. Find player position
  2. Project it on navigation
  3. MoveTo that position.

The problem - when player changes his position to a new one, AI character still moves to previous player position, then stops, find and project new player position and so on. But I want this AI character to “correct” his MoveTo on execution.

I tried to move this branch into separate sequence with service, which checks previous and current player positions and aborts itself if they are not match, but result is the same - AI character still stops everytime.

So, is there any solution to make AI character follow player CONTINUOUSLY.

Thank you!

why not just set the move to target to be the player actor instead of their location. that way the only time they will stop is if blocked by walls, lack of nav mesh, or they accomplish in reaching the player. basically it will make them run to the player continuously.

Use "move to’ node in the behavior
tree and set the blackboard key to a
‘Target Actor’, and only allow
execution if the blackboard value
‘Target Actor’ is set.

How? MoveTo task accepts only Vector type keys.


I’m doing it already.

Problem is - if player moves, AI moves to last player location, stops, and moves to new location. But I want it to move without any stops, and always to current player location.

Use "move to’ node in the behavior tree and set the blackboard key to a ‘Target Actor’, and only allow execution if the blackboard value ‘Target Actor’ is set. You could set and clear the ‘Target Actor’ from within the AI controller if you are using AI Perception.

Also you might want to put the ‘Default Focus’ service on the ‘move to’ if you want your AI to focus on your ‘Target Actor’, this will allow you to rotate the AI to face the ‘Target Actor’, or you could simple check the ‘Observe Blackboard Value Tolerance’ within the ‘move to’ node to check every so often if the ‘Target Actor’ has changed location.

Finally you can run a check by using a built in decorated called ‘Is At Location’, so you can do something when your AI reached the ‘Target Actor’.

Does this help you at all? I’m not sure I understand the problem exactly

This is inside in my Bots brain BTS from the “Event receive tick” execution

Hmm ok thats wierd i’m not having that issue. It might be the way my ai works for my specific game.
Its been a while since I’ve done this project, i’ll try to dig more if I can figure some solution

What does your behavior tree look like?

Ok, I think there might be an issue with using a decorator for this functionality (I could be wrong). The way I set up my Bot is that I’m checking how far away I’m from the player → setting different bot states and based on the blackboard condition I’m activating different BTTasks. I think I had a similar issue when I tried using decorators. Here is a reference of how my Tree is set up. (Again this could be completely wrong).

Hopefully this helps you narrow down the problem.


AI checking is he can attack player by weapon range, if not - to move to player (enemy) location.

Problem not in decorator, but, as I think, in MoveTo task. Once controller gets valid MoveTo location, it starts to execute until character reaches it. Only after that whole branch is restarted, controller gets new MoveTo location, and executes it again.

This works if AI character gets enemy location who stands on the same place. But if enemy location is changes continuously (so player trying to escape from this ai character), this not work. Ai character always stops in some intermediate locations while chasing his enemy.

I also tried to update location value in blackboard with Tick, but it looks like MoveTo uses only location it gets when started execution.

I’m just stupid, sorry.

I have created my own version of MoveTo task and it works as I want.

Anyway, thank you all for you advice!

I’m glad to hear you found the solution redbox! =)

Thx it worked, when you use the good node ! move ai and not move actor !

Hello, sorry if I reactivate this post but I have the same problem and the solution is no longer visible. Would it be possible to put it back? Thank you very much