1. 程式人生 > >UE4 — AI Perception: Senses and stimuli source

UE4 — AI Perception: Senses and stimuli source

Unreal Engine 4 — AI Perception: Senses and stimuli source

In this short tutorial, we’re going to see the basics of senses and stimuli sources using the Unreal Engine. Using AI perception makes it really easy for an AI to detect ennemies, or other objects. But while the Unreal Engine provides a good documentation on AI and behavior trees (

here), there are few things on AI perception.

The basics.

The AI perception system allows an AI controller to perceive elements in its environnement. These elements are actors with the AIPerceptionStimuliSourceComponent attached. This component allow us to specify how the senses of an AI will be stimulated: for instance the stimuli source could stimulate the sight, the hearing, or any other sense of an AI.

On the other side, there is the AI. To make an AIController able to perceive stimuli sources, we have to attach it the component AIPerceptionComponent. This component describes how the AI is able to perceive its environment. For instance, we will use AIPerceptionComponent to define that the controller can “see” its environment (i.e. will be stimulated by the sources stimulating the sight), and it’s also there that we will set the sense configuration (the radius and angle of vision, the perceivable types of sources, etc.).

Defining a stimuli source.

First, let’s define a stimuli source. We create a new actor and add it the component AIPerceptionStimuliSource.