How it works...

In this example, we are effectively hard-coding this enemy to follow the player character by doing simple vector math ourselves. While this technically works, it doesn't make use of Unreal's built-in AI functionality. It will also stop the AI at walls since there is no actual path-finding going on, and it will break the player character if you let the AI catch up. The player won't be able to move anymore due to collisions.

The rest of this chapter will be working with Unreal's actual built-in systems, which create a much more robust implementation.