Unreal Engine 4 AIController::SetFocus

From this link

AIController.SetFocus is used to keep AI controlled pawn rotated towards given actor or point in space. There are a few priorities of focus points, allowing easy creation of e.g. scripted overrides. For example:

1. AI is moving and path following automatically sets intermediate destination as focal point with low priority (EAIFocusPriority::Move). AI’s pawn is facing forward as it moves around.

2. AI receives a target and sets it as focal point with higher priority (EAIFocusPriority::Gameplay). Pawn starts facing toward target as it keeps moving.

3. Level script forces AI to look at specific point, setting it as even higher priority (EAIFocusPriority::LastFocusPriority + 1, usually defined by project as something more readable…). Pawn rotates toward this point.

4. Movement stops, pawn still looks at whatever script told it to.

5. Script clears forced focus point, pawn rotate towards most important focal point, which is right now target.

6. Target is cleared, pawn keeps current rotation since there’s no focal points to look at.

Leave a comment