Navigation
API > API/Runtime > API/Runtime/AIModule
Inheritance Hierarchy
- AController
- IAIPerceptionListenerInterface
- IGameplayTaskOwnerInterface
- IGenericTeamAgentInterface
- IVisualLoggerDebugSnapshotInterface
- AAIController
- ADetourCrowdAIController
- AGridPathAIController
References
| Module | AIModule |
| Header | /Engine/Source/Runtime/AIModule/Classes/AIController.h |
| Include | #include "AIController.h" |
Syntax
UCLASS (ClassGroup=AI, BlueprintType, Blueprintable, MinimalAPI)
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 | ||
| FPathFindingQuery & | Query | ||
| FAIMoveCompletedSignature | ReceiveMoveCompleted | Blueprint notification that we've completed the current movement request | |
| EPathFollowingResult::Type | Result |
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 | DisplayDebug
(
UCanvas* Canvas, |
||
| void | FindPathForMoveRequest
(
const FAIMoveRequest& MoveRequest, |
Finds path for given move request | |
| UDEPRECATED_PawnActionsComponent * | DEPRECATED. | ||
| 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 |
||
| AActor * | GetGameplayTaskAvatar
(
const UGameplayTask* Task |
||
| uint8 | |||
| AActor * | GetGameplayTaskOwner
(
const UGameplayTask* Task |
||
| UGameplayTasksComponent * | |||
| UGameplayTasksComponent * | GetGameplayTasksComponent
(
const UGameplayTask& Task |
||
| FVector | Returns position of current path segment's end. | ||
| EPathFollowingStatus::Type | Returns status of path following | ||
| IPathFollowingAgentInterface * | |||
| UPathFollowingComponent * | Returns PathFollowingComponent subobject | ||
| void | GrabDebugSnapshot
(
FVisualLogEntry* Snapshot |
||
| bool | Returns true if the current PathFollowingComponent's path is partial (does not reach desired destination). | ||
| bool | InitializeBlackboard
(
UBlackboardComponent& BlackboardComp, |
||
| bool | |||
| 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 | OnGameplayTaskActivated
(
UGameplayTask& Task |
||
| void | OnGameplayTaskDeactivated
(
UGameplayTask& Task |
||
| void | OnGameplayTaskInitialized
(
UGameplayTask& Task |
Add empty overrides to fix linker errors if project implements a child class without adding GameplayTasks module dependency | |
| void | OnGameplayTaskResourcesClaimed
(
FGameplayResourceSet NewlyClaimed, |
||
| void | OnMoveCompleted
(
FAIRequestID RequestID, |
Called on completing current movement request | |
| void | OnPossess
(
APawn* InPawn |
||
| void | OnUnPossess () |
||
| 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 | PerformAction
(
UDEPRECATED_PawnAction& Action, |
||
| void | |||
| void | |||
| FAIRequestID | RequestMove
(
const FAIMoveRequest& MoveRequest, |
Passes move request and path object to path following | |
| void | Reset () |
||
| 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 | SetPawn
(
APawn* InPawn |
||
| void | SetPerceptionComponent
(
UAIPerceptionComponent& InPerceptionComponent |
||
| bool | |||
| bool | ShouldSyncBlackboardWith
(
const UBlackboardComponent& OtherBlackboardComponent |
Does this AIController allow given UBlackboardComponent sync data with it | |
| void | StopMovement () |
Aborts the move the controller is currently performing | |
| bool | SuggestTossVelocity
(
FVector& OutTossVelocity, |
Computes a launch velocity vector to toss a projectile and hit the given destination. | |
| void | Tick
(
float DeltaTime |
||
| 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 IAIPerceptionListenerInterface
| Type | Name | Description | |
|---|---|---|---|
| UAIPerceptionComponent * |
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 |
Constants
| Name | Description |
|---|---|
| bAIIgnorePlayers | If true, AI controllers will ignore players. |
See Also
https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Controller/