Move player to the closest AI

Hi! I am making a third person combat game.

How do I move my character to the closest AI when an attack combo is executed.

I tried “Simple move to actor/location” but it can’t be linked to the AI. Pawn Sensing doesn’t work either.

Hey there,

There could be several approaches to this, especially if you are willing to do some C++ work. But here is one option: How to get location of closest enemy pawn? - #3 by ThompsonN13

Essentially, you could get closest actors and then use grt overlapping actors to filter for the enemy AI

  1. Find Nearest Actor | Unreal Engine Documentation
  2. Get Overlapping Actors | Unreal Engine Documentation

If you have a navmesh, you may be able to use simple move to location or simple move to actor. But I don’t think you can use the other AI nodes unless your player is possessed by an AI controller.

1 Like

Thanks, I found the solution.

I used the find actor of class and then simple move to actor.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.