Navigation
Unreal Engine C++ API Reference > Runtime > Engine > GameFramework
Inheritance Hierarchy
References
Module | Engine |
Header | /Engine/Source/Runtime/Engine/Classes/GameFramework/Controller.h |
Include | #include "GameFramework/Controller.h" |
Syntax
UCLASS (Abstract, NotPlaceable, NotBlueprintable,
HideCategories=(Collision, Rendering, Transformation), MinimalAPI)
class AController :
public AActor ,
public INavAgentInterface
Remarks
Controllers are non-physical actors that can possess a Pawn to control its actions. PlayerControllers are used by human players to control pawns, while AIControllers implement the artificial intelligence for the pawns they control. Controllers take control of a pawn using their Possess() method, and relinquish control of the pawn by calling UnPossess().
Controllers receive notifications for many of the events occurring for the Pawn they are controlling. This gives the controller the opportunity to implement the behavior in response to this event, intercepting the event and superseding the Pawn's default behavior.
ControlRotation (accessed via GetControlRotation()), determines the viewing/aiming direction of the controlled Pawn and is affected by input such as from a mouse or gamepad.
Variables
Type | Name | Description | |
---|---|---|---|
![]() ![]() ![]() |
uint8: 1 | bAttachToPawn | If true, the controller location will match the possessed Pawn's location. |
![]() |
uint8: 1 | bCanPossessWithoutAuthority | Whether the controller must have authority to be able to call possess on a Pawn |
![]() |
uint8: 1 | bIsPlayerController | Whether this controller is a PlayerController. |
![]() ![]() |
FRotator | ControlRotation | The control rotation of the Controller. See GetControlRotation. |
![]() |
uint8 | IgnoreLookInput | Ignores look input. |
![]() |
uint8 | IgnoreMoveInput | Ignores movement input. |
![]() ![]() ![]() |
FInstigatedAnyDamageSignature | OnInstigatedAnyDamage | Called when the controller has instigated damage in any way |
![]() |
FPawnChangedSignature | OnNewPawn | Delegate broadcast on authorities when possessing a new pawn or unpossessing one |
![]() ![]() ![]() ![]() |
FOnPossessedPawnChanged | OnPossessedPawnChanged | Called on both authorities and clients when the possessed pawn changes (either OldPawn or NewPawn might be nullptr) |
![]() ![]() ![]() ![]() ![]() |
TObjectPtr< APlayerState > | PlayerState | PlayerState containing replicated information about the player using this controller (only exists for players, not NPCs). |
![]() |
TWeakObjectPtr< class AActor > | StartSpot | Actor marking where this controller spawned in. |
![]() ![]() |
FName | StateName | Current gameplay state this controller is in |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
AController
(
const FObjectInitializer& ObjectInitializer |
Default Constructor |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | AddPawnTickDependency
(
APawn* NewPawn |
Add dependency that makes us tick before the given Pawn. |
![]() ![]() |
void | AttachToPawn
(
APawn* InPawn |
Physically attach the Controller to the specified Pawn, so that our position reflects theirs. |
![]() ![]() |
void | State entered when inactive (no possessed pawn, not spectating, etc). | |
![]() ![]() |
void | ChangeState
(
FName NewState |
Change the current state to named state |
![]() ![]() |
void | Called from Destroyed(). | |
![]() ![]() ![]() ![]() |
void | ClientSetLocation
(
FVector NewLocation, |
Replicated function to set the pawn location and rotation, allowing server to force (ex. teleports). |
![]() ![]() ![]() ![]() |
void | ClientSetRotation
(
FRotator NewRotation, |
Replicated function to set the pawn rotation, allowing the server to force. |
![]() ![]() |
void | Called when the level this controller is in is unloaded via streaming. | |
![]() ![]() |
void | Detach the RootComponent from its parent, but only if bAttachToPawn is true and it was attached to a Pawn. | |
![]() ![]() |
void | DisplayDebug
(
UCanvas* Canvas, |
|
![]() ![]() |
void | Called when leaving the inactive state | |
![]() ![]() |
void | GameMode failed to spawn pawn for me. | |
![]() ![]() |
void | GameHasEnded
(
AActor* EndGameFocus, |
Called from game mode upon end of the game, used to transition to proper state. |
![]() ![]() |
ACharacter * | GetCharacter () |
Getter for Character |
![]() ![]() ![]() ![]() ![]() |
FRotator | Get the control rotation. | |
![]() ![]() ![]() ![]() ![]() |
FRotator | Get the desired pawn target rotation | |
![]() |
FPawnChangedSignature & | ||
![]() ![]() |
APawn * | GetPawn () |
Getter for Pawn |
![]() ![]() |
T * | GetPawn () |
Templated version of GetPawn, will return nullptr if cast fails |
![]() ![]() |
T * | ||
![]() ![]() ![]() ![]() ![]() |
void | GetPlayerViewPoint
(
FVector& Location, |
Returns Player's Point of View For the AI this means the Pawn's 'Eyes' ViewPoint For a Human player, this means the Camera's ViewPoint |
![]() ![]() |
FName | GetStateName () |
|
![]() ![]() |
USceneComponent * | Returns TransformComponent subobject | |
![]() ![]() ![]() ![]() ![]() |
AActor * | Get the actor the controller is looking at | |
![]() ![]() |
void | Spawns and initializes the PlayerState for this Controller | |
![]() ![]() |
void | InstigatedAnyDamage
(
float Damage, |
Called when this controller instigates ANY damage |
![]() ![]() |
bool | States (uses FNames for replication, correlated to state flags) | |
![]() ![]() ![]() ![]() ![]() |
bool | Returns whether this Controller is a local controller. | |
![]() ![]() ![]() ![]() |
bool | Returns whether this Controller is a locally controlled PlayerController. | |
![]() ![]() ![]() ![]() ![]() |
bool | Returns true if look input is ignored. | |
![]() ![]() ![]() ![]() ![]() |
bool | Returns true if movement input is ignored. | |
![]() ![]() ![]() ![]() |
bool | Returns whether this Controller is a PlayerController. | |
![]() ![]() |
bool | IsValidControlRotation
(
FRotator CheckRotation |
Return false if rotation contains NaN or extremely large values (usually resulting from uninitialized values). |
![]() ![]() ![]() ![]() |
APawn * | K2_GetPawn () |
Return the Pawn that is currently 'controlled' by this PlayerController |
![]() ![]() ![]() ![]() ![]() |
bool | LineOfSightTo
(
const AActor* Other, |
Checks line to center and top of other actor |
![]() ![]() |
void | Overridable native function for when this controller is asked to possess a pawn. | |
![]() ![]() ![]() |
void | OnRep_Pawn () |
Replication Notification Callbacks |
![]() ![]() ![]() |
void | ||
![]() ![]() |
void | OnUnPossess () |
Overridable native function for when this controller unpossesses its pawn. |
![]() ![]() |
void | PawnPendingDestroy
(
APawn* inPawn |
Called to unpossess our pawn because it is going to be destroyed. |
![]() ![]() ![]() ![]() |
void | Handles attaching this controller to the specified pawn. | |
![]() ![]() ![]() |
void | ReceiveInstigatedAnyDamage
(
float Damage, |
Event when this controller instigates ANY damage |
![]() ![]() ![]() |
void | ReceivePossess
(
APawn* PossessedPawn |
Blueprint implementable event to react to the controller possessing a pawn |
![]() ![]() ![]() |
void | ReceiveUnPossess
(
APawn* UnpossessedPawn |
Blueprint implementable event to react to the controller unpossessing a pawn |
![]() ![]() |
void | RemovePawnTickDependency
(
APawn* InOldPawn |
Remove dependency that makes us tick before the given Pawn. |
![]() ![]() ![]() ![]() |
void | Reset move and look input ignore flags. | |
![]() ![]() ![]() ![]() |
void | Stops ignoring look input by resetting the ignore look input state. | |
![]() ![]() ![]() ![]() |
void | Stops ignoring move input by resetting the ignore move input state. | |
![]() ![]() ![]() ![]() |
void | SetControlRotation
(
const FRotator& NewRotation |
Set the control rotation. |
![]() ![]() ![]() ![]() |
void | SetIgnoreLookInput
(
bool bNewLookInput |
Locks or unlocks look input, consecutive calls stack up and require the same amount of calls to undo, or can all be undone using ResetIgnoreLookInput. |
![]() ![]() ![]() ![]() |
void | SetIgnoreMoveInput
(
bool bNewMoveInput |
Locks or unlocks movement input, consecutive calls stack up and require the same amount of calls to undo, or can all be undone using ResetIgnoreMoveInput. |
![]() ![]() ![]() ![]() |
void | SetInitialLocationAndRotation
(
const FVector& NewLocation, |
Set the initial location and rotation of the controller, as well as the control rotation. |
![]() ![]() |
void | Setter for Pawn. Normally should only be used internally when possessing/unpossessing a Pawn. | |
![]() |
void | SetPawnFromRep
(
APawn* InPawn |
Calls SetPawn and RepNotify locally |
![]() |
void | SetPlayerState
(
APlayerState* InPlayerState |
|
![]() ![]() ![]() |
bool | Returns whether this controller should persist through seamless travel | |
![]() ![]() ![]() ![]() |
void | StopMovement () |
Aborts the move the controller is currently performing |
![]() ![]() ![]() ![]() |
void | UnPossess () |
Called to unpossess our pawn for any reason that is not the pawn being destroyed (destruction handled by PawnDestroyed()). |
Overridden from AActor
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | Destroyed () |
Called when this actor is explicitly being destroyed during gameplay or in the editor, not called during level streaming or gameplay ending |
![]() ![]() ![]() |
void | GetActorEyesViewPoint
(
FVector& OutLocation, |
Returns the point of view of the actor. |
![]() ![]() ![]() |
FString | Returns the human readable string representation of an object. | |
![]() ![]() |
void | Destroy the actor | |
![]() ![]() |
void | Overridden to create the player replication info and perform other mundane initialization tasks. | |
![]() ![]() |
void | Reset () |
Reset actor to initial state - used when restarting level without reloading. |
![]() ![]() |
void | TickActor
(
float DeltaTime, |
Dispatches the once-per frame Tick() function for this actor |
Overridden from UObject
Type | Name | Description | |
---|---|---|---|
![]() ![]() ![]() |
void | GetLifetimeReplicatedProps
(
TArray< FLifetimeProperty >& OutLifetimeProps |
Returns the properties used for network replication, this needs to be overridden by all actor classes with native replicated properties |
Overridden from INavAgentInterface
Type | Name | Description | |
---|---|---|---|
![]() ![]() ![]() |
void | GetMoveGoalReachTest
(
const AActor* MovingActor, |
Get cylinder for testing if actor has been reached |
![]() ![]() ![]() |
FVector | Retrieves Agent's location | |
![]() ![]() ![]() |
const FNavAgentProperties & | Retrieves FNavAgentProperties expressing navigation props and caps of represented agent @NOTE the function will be renamed to GetNavAgentProperties in 4.8. | |
![]() ![]() ![]() |
IPathFollowingAgentInterface * | Retrieves PathFollowingAgent for this NavAgent | |
![]() ![]() ![]() |
bool | Checks if the agent is actively following a navigation path | |
![]() ![]() ![]() |
bool | Allows delaying repath requests |
See Also
https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Controller/