Navigation
API > API/Runtime > API/Runtime/AIModule
AIController is the base class of controllers for AI-controlled Pawns.
Controllers are non-physical actors that can be attached to a pawn to control its actions. AIControllers manage the artificial intelligence for the pawns they control. In networked games, they only exist on the server.
| Name | AAIController |
| Type | class |
| Header File | /Engine/Source/Runtime/AIModule/Classes/AIController.h |
| Include Path | #include "AIController.h" |
Syntax
UCLASS (ClassGroup=AI, BlueprintType, Blueprintable, MinimalAPI)
class AAIController :
public AController ,
public IAIPerceptionListenerInterface ,
public IGameplayTaskOwnerInterface ,
public IGenericTeamAgentInterface ,
public IVisualLoggerDebugSnapshotInterface
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → AActor → AController → AAIController
Implements Interfaces
- INavAgentInterface
- IAIPerceptionListenerInterface
- IGameplayTaskOwnerInterface
- IGenericTeamAgentInterface
- IVisualLoggerDebugSnapshotInterface
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
AAIController
(
const FObjectInitializer& ObjectInitializer |
AIController.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| bAIIgnorePlayers | bool | If true, AI controllers will ignore players. | AIController.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bAllowStrafe | uint32 | Is strafing allowed during movement? | AIController.h |
|
| bLOSflag | uint32 | Used for alternating LineOfSight traces | AIController.h | |
| BrainComponent | TObjectPtr< UBrainComponent > | Component responsible for behaviors. | AIController.h |
|
| bSetControlRotationFromPawnOrientation | uint32 | Copy Pawn rotation to ControlRotation, if there is no focus point. | AIController.h |
|
| bSkipExtraLOSChecks | uint32 | Skip extra line of sight traces to extremities of target being checked. | AIController.h |
|
| bWantsPlayerState | uint32 | Specifies if this AI wants its own PlayerState. | AIController.h |
|
| PerceptionComponent | TObjectPtr< UAIPerceptionComponent > | AIController.h |
|
|
| ReceiveMoveCompleted | FAIMoveCompletedSignature | Blueprint notification that we've completed the current movement request | AIController.h |
|
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| PathFollowingComponent | TObjectPtr< UPathFollowingComponent > | Component used for moving along a path. | AIController.h |
|
| ScriptClaimedResources | FGameplayResourceSet | AIController.h | ||
| TeamID | FGenericTeamId | AIController.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Notifies AIController of changes in given actors' perception | AIController.h | ||
bool BuildPathfindingQuery
(
const FAIMoveRequest& MoveRequest, |
Helper function for creating pathfinding query for this agent from move request data and starting location | AIController.h | |
bool BuildPathfindingQuery
(
const FAIMoveRequest& MoveRequest, |
Helper function for creating pathfinding query for this agent from move request data | AIController.h | |
void ClaimTaskResource
(
TSubclassOf< UGameplayTaskResource > ResourceClass |
AIController.h |
|
|
virtual void ClearFocus
(
EAIFocusPriority::Type InPriority |
Clears Focus for given priority, will also clear FocalPoint as a result | AIController.h | |
virtual void FindPathForMoveRequest
(
const FAIMoveRequest& MoveRequest, |
Finds path for given move request | AIController.h | |
| AIController.h |
|
||
const UAIPerceptionComponent * GetAIPerceptionComponent () |
AIController.h | ||
| AIController.h | |||
const UBlackboardComponent * GetBlackboardComponent () |
AIController.h | ||
UBrainComponent * GetBrainComponent() |
AIController.h | ||
FAIRequestID GetCurrentMoveRequestID() |
Returns the Move Request ID for the current move | AIController.h | |
virtual FString GetDebugIcon() |
Debug/dev-time | AIController.h | |
TSubclassOf< UNavigationQueryFilter > GetDefaultNavigationFilterClass() |
AIController.h | ||
FVector GetFocalPoint() |
Retrieve the final position that controller should be looking at. | AIController.h |
|
FVector GetFocalPointForPriority
(
EAIFocusPriority::Type InPriority |
AIController.h | ||
virtual FVector GetFocalPointOnActor
(
const AActor* Actor |
Retrieve the focal point this controller should focus to on given actor. | AIController.h |
|
AActor * GetFocusActor() |
Get the focused actor. | AIController.h |
|
AActor * GetFocusActorForPriority
(
EAIFocusPriority::Type InPriority |
AIController.h | ||
| AIController.h | |||
FVector GetImmediateMoveDestination() |
Returns position of current path segment's end. | AIController.h |
|
EPathFollowingStatus::Type GetMoveStatus() |
Returns status of path following | AIController.h |
|
UPathFollowingComponent * GetPathFollowingComponent() |
Returns PathFollowingComponent subobject | AIController.h |
|
bool HasPartialPath() |
Returns true if the current PathFollowingComponent's path is partial (does not reach desired destination). | AIController.h |
|
void K2_ClearFocus() |
Clears Focus, will also clear FocalPoint as a result | AIController.h |
|
void K2_SetFocalPoint
(
FVector FP |
Set the position that controller should be looking at. | AIController.h |
|
void K2_SetFocus
(
AActor* NewFocus |
Set Focus for actor, will set FocalPoint as a result. | AIController.h |
|
virtual bool LineOfSightTo
(
const AActor* Other, |
Checks line to center and top of other actor | AIController.h | |
virtual FPathFollowingRequestResult MoveTo
(
const FAIMoveRequest& MoveRequest, |
Makes AI go toward specified destination | AIController.h | |
EPathFollowingRequestResult::Type MoveToActor
(
AActor* Goal, |
Makes AI go toward specified Goal actor (destination will be continuously updated), aborts any active path following | AIController.h |
|
EPathFollowingRequestResult::Type MoveToLocation
(
const FVector& Dest, |
Makes AI go toward specified Dest location, aborts any active path following | AIController.h |
|
virtual void OnGameplayTaskResourcesClaimed
(
FGameplayResourceSet NewlyClaimed, |
AIController.h | ||
virtual void OnMoveCompleted
(
FAIRequestID RequestID, |
AIController.h | ||
virtual void OnMoveCompleted
(
FAIRequestID RequestID, |
Called on completing current movement request | AIController.h | |
bool PauseMove
(
FAIRequestID RequestToPause |
If AI is currently moving due to request given by RequestToPause, then the move will be paused | AIController.h | |
virtual bool PreparePathfinding
(
const FAIMoveRequest& MoveRequest, |
AIController.h | ||
virtual FAIRequestID RequestMove
(
const FAIMoveRequest& MoveRequest, |
Passes move request and path object to path following | AIController.h | |
virtual FAIRequestID RequestPathAndMove
(
const FAIMoveRequest& MoveRequest, |
AIController.h | ||
bool ResumeMove
(
FAIRequestID RequestToResume |
Resumes last AI-performed, paused request provided it's ID was equivalent to RequestToResume | AIController.h | |
virtual bool RunBehaviorTree
(
UBehaviorTree* BTAsset |
Starts executing behavior tree. | AIController.h |
|
virtual void SetFocalPoint
(
FVector NewFocus, |
Set FocalPoint for given priority as absolute position or offset from base. | AIController.h | |
virtual void SetFocus
(
AActor* NewFocus, |
Set Focus actor for given priority, will set FocalPoint as a result. | AIController.h | |
void SetMoveBlockDetection
(
bool bEnable |
Updates state of movement block detection. | AIController.h |
|
void SetPathFollowingComponent
(
UPathFollowingComponent* NewPFComponent |
Note that this function does not do any pathfollowing state transfer. | AIController.h |
|
void SetPerceptionComponent
(
UAIPerceptionComponent& InPerceptionComponent |
AIController.h | ||
virtual bool ShouldSyncBlackboardWith
(
const UBlackboardComponent& OtherBlackboardComponent |
Does this AIController allow given UBlackboardComponent sync data with it | AIController.h | |
bool SuggestTossVelocity
(
FVector& OutTossVelocity, |
Computes a launch velocity vector to toss a projectile and hit the given destination. | AIController.h | |
void UnclaimTaskResource
(
TSubclassOf< UGameplayTaskResource > ResourceClass |
AIController.h |
|
|
virtual void UpdateControlRotation
(
float DeltaTime, |
Update direction AI is looking based on FocalPoint | AIController.h | |
bool UseBlackboard
(
UBlackboardData* BlackboardAsset, |
Makes AI use the specified Blackboard asset & creates a Blackboard Component if one does not already exist. | AIController.h |
|
Overridden from AController
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void DisplayDebug
(
UCanvas* Canvas, |
AIController.h | ||
virtual void SetPawn
(
APawn* InPawn |
AIController.h | ||
virtual void StopMovement() |
Aborts the move the controller is currently performing | AIController.h |
Overridden from AActor
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void PostInitializeComponents() |
AIController.h | ||
virtual void PostRegisterAllComponents() |
AIController.h | ||
virtual void Reset() |
AIController.h | ||
virtual void Tick
(
float DeltaTime |
AIController.h |
Overridden from INavAgentInterface
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual IPathFollowingAgentInterface * GetPathFollowingAgent() |
AIController.h | ||
virtual bool IsFollowingAPath() |
AIController.h | ||
virtual bool ShouldPostponePathUpdates() |
AIController.h |
Overridden from IAIPerceptionListenerInterface
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual UAIPerceptionComponent * GetPerceptionComponent() |
AIController.h |
Overridden from IGameplayTaskOwnerInterface
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual AActor * GetGameplayTaskAvatar
(
const UGameplayTask* Task |
AIController.h | ||
virtual uint8 GetGameplayTaskDefaultPriority() |
AIController.h | ||
virtual AActor * GetGameplayTaskOwner
(
const UGameplayTask* Task |
AIController.h | ||
virtual UGameplayTasksComponent * GetGameplayTasksComponent
(
const UGameplayTask& Task |
AIController.h | ||
virtual void OnGameplayTaskActivated
(
UGameplayTask& Task |
AIController.h | ||
virtual void OnGameplayTaskDeactivated
(
UGameplayTask& Task |
AIController.h | ||
virtual void OnGameplayTaskInitialized
(
UGameplayTask& Task |
Add empty overrides to fix linker errors if project implements a child class without adding GameplayTasks module dependency | AIController.h |
Overridden from IGenericTeamAgentInterface
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FGenericTeamId GetGenericTeamId() |
Retrieve team identifier in form of FGenericTeamId | AIController.h | |
virtual void SetGenericTeamId
(
const FGenericTeamId& TeamID |
Assigns Team Agent to given TeamID | AIController.h |
Overridden from IVisualLoggerDebugSnapshotInterface
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void GrabDebugSnapshot
(
FVisualLogEntry* Snapshot |
AIController.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void CleanupBrainComponent() |
AIController.h | ||
virtual bool InitializeBlackboard
(
UBlackboardComponent& BlackboardComp, |
AIController.h | ||
virtual void MergePaths
(
const FNavPathSharedPtr& InitialPath, |
Merges the remaining points of InitialPath, with the points of InOutMergedPath. | AIController.h | |
void OnUsingBlackBoard
(
UBlackboardComponent* BlackboardComp, |
AIController.h |
|
Overridden from AController
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void OnPossess
(
APawn* InPawn |
AIController.h | ||
virtual void OnUnPossess() |
AIController.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static bool AreAIIgnoringPlayers() |
AIController.h | ||
static void ToggleAIIgnorePlayers() |
Cheat/debugging functions. | AIController.h |