Adding the challenge

Now, we will add line traces to the AI character. In our demonstration, we will use traces to detect the wall in front of the pawn. Other examples of using traces in the AI include Line of Sight checking, getting surface rotation, and getting nearby actors.

Let's go back to Unreal Engine Level Editor and look within Content Browser. Perform the following steps:

  1. Rename our MyController blueprint Hero; this will act as the player in this scenario.
  2. Open our Hero blueprint and go to the EventGraph section.
  3. Now, remove every node except the Event Tick and Move to Location nodes. We will replace these with new blueprint scripting:
    Adding the challenge

    Blueprint ...

Get Unreal Engine 4 AI Programming Essentials 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.