Download

How to make AI player always face player and thus go to them?

I worked a few tutorials that proposed this very concept but it is not working. In my Beat Em Up example, the AI players approach the player but as soon as he is past them they just stop and do not turn to face the player and pursue the player.

Any help , links, or tips are appreciated, thanks!

There are many way to do it. But here is one. Assuming you have a valid NavMesh:

  • move the AI controlled character with AAIController::MoveToLocation() to some target location within bounds of the nav mesh
  • rotate the AI controlled character with FMath::RInterpTo() to some target rotation

Should be done every Tick(). We do this inside a class extended from AAIController() that controls bots. Each bot gets its own AAIController() when it spawns.