Navigation
API > API/Runtime > API/Runtime/AIModule
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- AActor
- AController
- AAIController
- ADetourCrowdAIController
- AGridPathAIController
References
Module | AIModule |
Header | /Engine/Source/Runtime/AIModule/Classes/AIController.h |
Include | #include "AIController.h" |
Syntax
class AAIController :
public AController,
public IAIPerceptionListenerInterface,
public IGameplayTaskOwnerInterface,
public IGenericTeamAgentInterface,
public IVisualLoggerDebugSnapshotInterface
Remarks
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.
Variables
Type | Name | Description | |
---|---|---|---|
![]() |
uint32: 1 | bAllowStrafe | Is strafing allowed during movement? |
![]() |
TObjectPtr< UBlackboardComponent > | Blackboard | Blackboard |
![]() |
uint32: 1 | bLOSflag | Used for alternating LineOfSight traces |
![]() |
TObjectPtr< UBrainComponent > | BrainComponent | Component responsible for behaviors. |
![]() |
uint32: 1 | bSetControlRotationFromPawnOrientation | Copy Pawn rotation to ControlRotation, if there is no focus point. |
![]() |
uint32: 1 | bSkipExtraLOSChecks | Skip extra line of sight traces to extremities of target being checked. |
![]() |
uint32: 1 | bStartAILogicOnPossess | By default AI's logic does not start when controlled Pawn is possessed. |
![]() |
uint32: 1 | bStopAILogicOnUnposses | By default AI's logic gets stopped when controlled Pawn is unpossessed. |
![]() |
uint32: 1 | bWantsPlayerState | Specifies if this AI wants its own PlayerState. |
![]() |
TObjectPtr< UGameplayTasksComponent > | CachedGameplayTasksComponent | |
![]() |
TSubclassOf< UNavigationQueryFilter > | DefaultNavigationFilterClass | |
![]() |
FFocusKnowledge | FocusInformation | |
![]() |
TObjectPtr< UAIPerceptionComponent > | PerceptionComponent | |
![]() |
FAIMoveCompletedSignature | ReceiveMoveCompleted | Blueprint notification that we've completed the current movement request |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
AAIController
(
const FObjectInitializer& ObjectInitializer |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | ActorsPerceptionUpdated
(
const TArray< AActor* >& UpdatedActors |
Notifies AIController of changes in given actors' perception |
![]() ![]() |
bool | ||
![]() ![]() |
bool | BuildPathfindingQuery
(
const FAIMoveRequest& MoveRequest, |
Helper function for creating pathfinding query for this agent from move request data |
![]() |
void | ClaimTaskResource
(
TSubclassOf< UGameplayTaskResource > ResourceClass |
|
![]() ![]() |
void | ||
![]() ![]() |
void | ClearFocus
(
EAIFocusPriority::Type InPriority |
Clears Focus for given priority, will also clear FocalPoint as a result |
![]() ![]() ![]() |
void | FindPathForMoveRequest
(
const FAIMoveRequest& MoveRequest, |
Finds path for given move request |
![]() ![]() |
const UAIPerceptionComponent * | ||
![]() |
UAIPerceptionComponent * | ||
![]() ![]() |
const UBlackboardComponent * | ||
![]() |
UBlackboardComponent * | ||
![]() ![]() |
UBrainComponent * | ||
![]() ![]() |
FAIRequestID | Returns the Move Request ID for the current move | |
![]() ![]() ![]() |
FString | GetDebugIcon () |
Debug/dev-time |
![]() ![]() |
TSubclassOf< UNavigationQueryFilter > | ||
![]() ![]() |
UDEPRECATED_PawnActionsComponent * | ||
![]() ![]() |
FVector | Retrieve the final position that controller should be looking at. | |
![]() ![]() |
FVector | GetFocalPointForPriority
(
EAIFocusPriority::Type InPriority |
|
![]() ![]() ![]() |
FVector | GetFocalPointOnActor
(
const AActor* Actor |
Retrieve the focal point this controller should focus to on given actor. |
![]() ![]() |
AActor * | Get the focused actor. | |
![]() ![]() |
AActor * | GetFocusActorForPriority
(
EAIFocusPriority::Type InPriority |
|
![]() ![]() |
UGameplayTasksComponent * | ||
![]() ![]() |
FVector | Returns position of current path segment's end. | |
![]() ![]() |
EPathFollowingStatus::Type | Returns status of path following | |
![]() ![]() |
UPathFollowingComponent * | Returns PathFollowingComponent subobject | |
![]() ![]() |
bool | Returns true if the current PathFollowingComponent's path is partial (does not reach desired destination). | |
![]() ![]() |
bool | InitializeBlackboard
(
UBlackboardComponent& BlackboardComp, |
|
![]() |
void | Clears Focus, will also clear FocalPoint as a result | |
![]() |
void | K2_SetFocalPoint
(
FVector FP |
Set the position that controller should be looking at. |
![]() |
void | K2_SetFocus
(
AActor* NewFocus |
Set Focus for actor, will set FocalPoint as a result. |
![]() ![]() ![]() |
bool | LineOfSightTo
(
const AActor* Other, |
Checks line to center and top of other actor |
![]() ![]() |
FPathFollowingRequestResult | MoveTo
(
const FAIMoveRequest& MoveRequest, |
Makes AI go toward specified destination |
![]() |
EPathFollowingRequestResult::Type | MoveToActor
(
AActor* Goal, |
Makes AI go toward specified Goal actor (destination will be continuously updated), aborts any active path following |
![]() |
EPathFollowingRequestResult::Type | MoveToLocation
(
const FVector& Dest, |
Makes AI go toward specified Dest location, aborts any active path following |
![]() ![]() |
void | OnGameplayTaskResourcesClaimed
(
FGameplayResourceSet NewlyClaimed, |
|
![]() ![]() |
void | OnMoveCompleted
(
FAIRequestID RequestID, |
|
![]() ![]() |
void | OnMoveCompleted
(
FAIRequestID RequestID, |
Called on completing current movement request |
![]() |
void | OnUsingBlackBoard
(
UBlackboardComponent* BlackboardComp, |
|
![]() |
bool | PauseMove
(
FAIRequestID RequestToPause |
If AI is currently moving due to request given by RequestToPause, then the move will be paused |
![]() ![]() |
bool | PreparePathfinding
(
const FAIMoveRequest& MoveRequest, |
|
![]() ![]() |
FAIRequestID | RequestMove
(
const FAIMoveRequest& MoveRequest, |
Passes move request and path object to path following |
![]() ![]() |
FAIRequestID | RequestPathAndMove
(
const FAIMoveRequest& MoveRequest, |
|
![]() |
bool | ResumeMove
(
FAIRequestID RequestToResume |
Resumes last AI-performed, paused request provided it's ID was equivalent to RequestToResume |
![]() ![]() |
bool | RunBehaviorTree
(
UBehaviorTree* BTAsset |
Starts executing behavior tree. |
![]() ![]() |
void | SetFocalPoint
(
FVector NewFocus, |
Set FocalPoint for given priority as absolute position or offset from base. |
![]() ![]() |
void | SetFocus
(
AActor* NewFocus, |
Set Focus actor for given priority, will set FocalPoint as a result. |
![]() |
void | SetMoveBlockDetection
(
bool bEnable |
Updates state of movement block detection. |
![]() |
void | SetPathFollowingComponent
(
UPathFollowingComponent* NewPFComponent |
Note that this function does not do any pathfollowing state transfer. |
![]() |
void | SetPerceptionComponent
(
UAIPerceptionComponent& InPerceptionComponent |
|
![]() ![]() ![]() |
bool | ShouldSyncBlackboardWith
(
const UBlackboardComponent& OtherBlackboardComponent |
Does this AIController allow given UBlackboardComponent sync data with it |
![]() |
bool | SuggestTossVelocity
(
FVector& OutTossVelocity, |
Computes a launch velocity vector to toss a projectile and hit the given destination. |
![]() ![]() |
void | Cheat/debugging functions. | |
![]() |
void | UnclaimTaskResource
(
TSubclassOf< UGameplayTaskResource > ResourceClass |
|
![]() ![]() |
void | UpdateControlRotation
(
float DeltaTime, |
Update direction AI is looking based on FocalPoint |
![]() |
bool | UseBlackboard
(
UBlackboardData* BlackboardAsset, |
Makes AI use the specified Blackboard asset & creates a Blackboard Component if one does not already exist. |
Overridden from AController
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | DisplayDebug
(
UCanvas* Canvas, |
|
![]() ![]() |
void | Overridable native function for when this controller is asked to possess a pawn. | |
![]() ![]() |
void | OnUnPossess () |
Overridable native function for when this controller unpossesses its pawn. |
![]() ![]() |
void | Setter for Pawn. Normally should only be used internally when possessing/unpossessing a Pawn. | |
![]() ![]() |
void | StopMovement () |
Aborts the move the controller is currently performing |
Overridden from AActor
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | Overridden to create the player replication info and perform other mundane initialization tasks. | |
![]() ![]() |
void | Called after all the components in the Components array are registered, called both in editor and during gameplay. | |
![]() ![]() |
void | Reset () |
Reset actor to initial state - used when restarting level without reloading. |
![]() ![]() |
void | Tick
(
float DeltaSeconds |
Function called every frame on this Actor. |
Overridden from INavAgentInterface
Type | Name | Description | |
---|---|---|---|
![]() ![]() ![]() |
IPathFollowingAgentInterface * | Retrieves PathFollowingAgent for this NavAgent | |
![]() ![]() ![]() |
bool | Checks if the agent is actively following a navigation path | |
![]() ![]() ![]() |
bool | Allows delaying repath requests |
Overridden from IAIPerceptionListenerInterface
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
UAIPerceptionComponent * |
Overridden from IGameplayTaskOwnerInterface
Type | Name | Description | |
---|---|---|---|
![]() ![]() ![]() |
AActor * | GetGameplayTaskAvatar
(
const UGameplayTask* Task |
Get "body" of task's owner / default, having location in world (e.g. Owner = AIController, Avatar = Pawn) |
![]() ![]() ![]() |
uint8 | Get default priority for running a task | |
![]() ![]() ![]() |
AActor * | GetGameplayTaskOwner
(
const UGameplayTask* Task |
Get owner of a task or default one when task is null |
![]() ![]() ![]() |
UGameplayTasksComponent * | GetGameplayTasksComponent
(
const UGameplayTask& Task |
Finds tasks component for given GameplayTask, Task.GetGameplayTasksComponent() may not be initialized at this point! |
![]() ![]() |
void | OnGameplayTaskActivated
(
UGameplayTask& Task |
Notify called after GameplayTask changes state to Active (initial activation or resuming) |
![]() ![]() |
void | OnGameplayTaskDeactivated
(
UGameplayTask& Task |
Notify called after GameplayTask changes state from Active (finishing or pausing) |
![]() ![]() |
void | OnGameplayTaskInitialized
(
UGameplayTask& Task |
Add empty overrides to fix linker errors if project implements a child class without adding GameplayTasks module dependency |
Overridden from IGenericTeamAgentInterface
Type | Name | Description | |
---|---|---|---|
![]() ![]() ![]() |
FGenericTeamId | Retrieve team identifier in form of FGenericTeamId | |
![]() ![]() |
void | SetGenericTeamId
(
const FGenericTeamId& TeamID |
Assigns Team Agent to given TeamID |
Overridden from IVisualLoggerDebugSnapshotInterface
Type | Name | Description | |
---|---|---|---|
![]() ![]() ![]() |
void | GrabDebugSnapshot
(
FVisualLogEntry* Snapshot |
Constants
Name | Description |
---|---|
bAIIgnorePlayers | If true, AI controllers will ignore players. |
Deprecated Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
UDEPRECATED_PawnActionsComponent * | PawnActions have been deprecated and are no longer being supported. It will get removed in following UE5 releases. Use GameplayTasks or AITasks instead. | |
![]() |
bool | PerformAction
(
UDEPRECATED_PawnAction& Action, |
PawnActions have been deprecated and are no longer being supported. It will get removed in following UE5 releases. Use GameplayTasks or AITasks instead. |
See Also
https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Controller/