Module |
|
Header |
/Engine/Source/Runtime/Engine/Classes/GameFramework/Controller.h |
Include |
#include "GameFramework/Controller.h" |
class AController :
public AActor,
public INavAgentInterface
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.
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. |
|
OnInstigatedAnyDamage |
Called when the controller has instigated damage in any way |
|
|
FPawnChangedSig... |
OnNewPawn |
Delegate broadcast on authorities when possessing a new pawn or unpossessing one |
|
OnPossessedPawnChanged |
Called on both authorities and clients when the possessed pawn changes (either OldPawn or NewPawn might be nullptr) |
|
|
TObjectPtr< APl... |
PlayerState |
PlayerState containing replicated information about the player using this controller (only exists for players, not NPCs). |
|
TWeakObjectPtr<... |
StartSpot |
Actor marking where this controller spawned in. |
|
StateName |
Current gameplay state this controller is in |
Name | Description | |
---|---|---|
|
AController ( |
Default Constructor |
Name | Description | ||
---|---|---|---|
|
void |
AddPawnTickDependency ( |
Add dependency that makes us tick before the given Pawn. |
|
void |
AttachToPawn ( |
Physically attach the Controller to the specified Pawn, so that our position reflects theirs. |
|
void |
BeginInactiveState() |
State entered when inactive (no possessed pawn, not spectating, etc). |
|
void |
ChangeState ( |
Change the current state to named state |
|
void |
CleanupPlayerState() |
Called from Destroyed(). |
|
void |
ClientSetLocation ( |
Replicated function to set the pawn location and rotation, allowing server to force (ex. teleports). |
|
void |
ClientSetRotation ( |
Replicated function to set the pawn rotation, allowing the server to force. |
|
void |
CurrentLevelUnloaded() |
Called when the level this controller is in is unloaded via streaming. |
|
void |
DetachFromPawn() |
Detach the RootComponent from its parent, but only if bAttachToPawn is true and it was attached to a Pawn. |
|
void |
DisplayDebug ( |
|
|
void |
EndInactiveState() |
Called when leaving the inactive state |
|
void |
FailedToSpawnPawn() |
GameMode failed to spawn pawn for me. |
|
void |
GameHasEnded ( |
Called from game mode upon end of the game, used to transition to proper state. |
|
ACharacter &... |
GetCharacter() |
Getter for Character |
|
FRotator |
GetControlRotation() |
Get the control rotation. |
|
FRotator |
GetDesiredRotation() |
Get the desired pawn target rotation |
|
FPawnChanged... |
GetOnNewPawnNotifier() |
|
|
APawn * |
GetPawn() |
Getter for Pawn |
|
T * |
GetPawn() |
Templated version of GetPawn, will return nullptr if cast fails |
|
T * |
GetPlayerState() |
|
|
void |
GetPlayerViewPoint ( |
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 |
|
GetStateName() |
||
|
USceneCompon... |
GetTransformComponent() |
Returns TransformComponent subobject |
|
AActor * |
GetViewTarget() |
Get the actor the controller is looking at |
|
void |
InitPlayerState() |
Spawns and initializes the PlayerState for this Controller |
|
void |
InstigatedAnyDamage ( |
Called when this controller instigates ANY damage |
|
bool |
IsInState ( |
States (uses FNames for replication, correlated to state flags) |
|
bool |
IsLocalController() |
Returns whether this Controller is a local controller. |
|
bool |
IsLocalPlayerController() |
Returns whether this Controller is a locally controlled PlayerController. |
|
bool |
IsLookInputIgnored() |
Returns true if look input is ignored. |
|
bool |
IsMoveInputIgnored() |
Returns true if movement input is ignored. |
|
bool |
IsPlayerController() |
Returns whether this Controller is a PlayerController. |
|
bool |
IsValidControlRotation ( |
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 ( |
Checks line to center and top of other actor |
|
void |
OnPossess ( |
Overridable native function for when this controller is asked to possess a pawn. |
|
void |
OnRep_Pawn() |
Replication Notification Callbacks |
|
void |
OnRep_PlayerState() |
|
|
void |
OnUnPossess() |
Overridable native function for when this controller unpossesses its pawn. |
|
void |
PawnPendingDestroy ( |
Called to unpossess our pawn because it is going to be destroyed. |
|
void |
Possess ( |
Handles attaching this controller to the specified pawn. |
|
void |
ReceiveInstigatedAnyDamage ( |
Event when this controller instigates ANY damage |
|
void |
ReceivePossess ( |
Blueprint implementable event to react to the controller possessing a pawn |
|
void |
ReceiveUnPossess ( |
Blueprint implementable event to react to the controller unpossessing a pawn |
|
void |
RemovePawnTickDependency ( |
Remove dependency that makes us tick before the given Pawn. |
|
void |
ResetIgnoreInputFlags() |
Reset move and look input ignore flags. |
|
void |
ResetIgnoreLookInput() |
Stops ignoring look input by resetting the ignore look input state. |
|
void |
ResetIgnoreMoveInput() |
Stops ignoring move input by resetting the ignore move input state. |
|
void |
SetControlRotation ( |
Set the control rotation. |
|
void |
SetIgnoreLookInput ( |
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 ( |
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 ( |
Set the initial location and rotation of the controller, as well as the control rotation. |
|
void |
SetPawn ( |
Setter for Pawn. Normally should only be used internally when possessing/unpossessing a Pawn. |
|
void |
SetPawnFromRep ( |
Calls SetPawn and RepNotify locally |
|
bool |
ShouldParticipateInSeamlessTravel() |
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()). |
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 ( |
Returns the point of view of the actor. |
|
GetHumanReadableName() |
Returns the human readable string representation of an object. |
|
|
void |
K2_DestroyActor() |
Destroy the actor |
|
void |
PostInitializeComponents() |
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 ( |
Dispatches the once-per frame Tick() function for this actor |
Name | Description | ||
---|---|---|---|
|
void |
GetLifetimeReplicatedProps ( |
Returns the properties used for network replication, this needs to be overridden by all actor classes with native replicated properties |
Name | Description | ||
---|---|---|---|
|
void |
GetMoveGoalReachTest ( |
Get cylinder for testing if actor has been reached |
|
FVector |
GetNavAgentLocation() |
Retrieves Agent's location |
|
const FNavAg... |
GetNavAgentPropertiesRef() |
Retrieves FNavAgentProperties expressing navigation props and caps of represented agent the function will be renamed to GetNavAgentProperties in 4.8. |
|
IPathFollowi... |
GetPathFollowingAgent() |
Retrieves PathFollowingAgent for this NavAgent |
|
bool |
IsFollowingAPath() |
Checks if the agent is actively following a navigation path |
|
bool |
ShouldPostponePathUpdates() |
Allows delaying repath requests |
Name | Description | ||
---|---|---|---|
|
void |
InitNavigationControl ( |
InitNavigationControl is depracated. The function lost its meaning due to better Engine-AIModule code separation |
|
void |
UpdateNavigationComponents() |
UpdateNavigationComponents is depracated. The function lost its meaning due to better Engine-AIModule code separation. |