Placing the AI in the level and testing

OK! We are done! Now all we have to do is place the AI in the level and test that everything we have done works! Ensure you place the AI at least 1500 units away from the player so that it does not automatically detect the player's location. With the AI in level, press play and you will see something similar to this:

Placing the AI in the level and testing

The red lines we are seeing is the debug sphere that is drawn during the sphere check. If you move within these lines, the AI will start to move towards you while pathing around the obstacles thanks to the NavMesh! Once the AI has targeted you, try running outside the bounds of the detection sphere ...

Get Unreal Engine 4.X By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.