Adding perception to an agent
In this section, we will create a new AI agent that will use the Perception System. We will create a security camera that will probe nearby surrounding areas, looking for some possible targets for the dummy gunner that we created in Chapter 9, Extending Behavior Trees. Think of it as some kind of infrared camera for a dark environment. Once the camera spots a target, it will tag it so that the gunner will be able to locate it in the environment.
We will start by creating an Actor
class that will be used as the camera model.
Creating the BaseSecurityCam class
Even though we will be implementing the Perception System inside the AI controller, a nice model to display in the level will help your environment’s look and feel, so let’s start by creating a new C++ class, extending from the Pawn
class and named BaseSecurityCam
. Once the class has been created, open the BaseSecurityCam.h
file and add the following forward declaration after...