APlayerController

PlayerControllers are used by human players to control Pawns.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/GameFramework/PlayerController.h

Include

#include "GameFramework/PlayerController.h"

Syntax

class APlayerController : public AController

Remarks

PlayerControllers are used by human players to control Pawns.

ControlRotation (accessed via GetControlRotation()), determines the aiming orientation of the controlled Pawn.

In networked games, PlayerControllers exist on the server for every player-controlled pawn, and also on the controlling client's machine. They do NOT exist on a client's machine for pawns controlled by remote players elsewhere on the network.

Variables

Name Description

Public variable

APawn *

 

AcknowledgedPawn

Used in net games so client can acknowledge it possessed a specific pawn.

Public variable

TArray< FActive...

 

ActiveForceFeedbackEffects

Public variable

TSharedPtr< str...

 

ActiveHapticEffect_Gun

Public variable

TSharedPtr< str...

 

ActiveHapticEffect_Left

Currently playing haptic effects for both the left and right hand

Public variable

TSharedPtr< str...

 

ActiveHapticEffect_Right

Protected variable

TWeakObjectPtr<...

 

AudioListenerAttenuationComponent

Component that is used to only override where attenuation calculations are computed from.

Protected variable

FVector

 

AudioListenerAttenuationOverride

Currently overridden vector used to do attenuation calculations for listener.

Protected variable

TWeakObjectPtr<...

 

AudioListenerComponent

Component that is currently driving the audio listener position/orientation

Protected variable

FVector

 

AudioListenerLocationOverride

Currently overridden location of audio listener

Protected variable

FRotator

 

AudioListenerRotationOverride

Currently overridden rotation of audio listener

Public variable

bool

 

bAutoManageActiveCameraTarget

True to allow this player controller to manage the camera target for you, typically by using the possessed pawn as the camera target.

Protected variable

uint32: 1

 

bCinemaDisableInputLook

Protected variable

uint32: 1

 

bCinemaDisableInputMove

The state of the inputs from cinematic mode

Public variable

uint32: 1

 

bCinematicMode

Is this player currently in cinematic mode? Prevents rotation/movement/firing/etc

Public variable

uint32: 1

 

bEnableClickEvents

Whether actor/component click events should be generated.

Public variable

uint32: 1

 

bEnableMouseOverEvents

Whether actor/component mouse over events should be generated.

Public variable

uint32: 1

 

bEnableTouchEvents

Whether actor/component touch events should be generated.

Public variable

uint32: 1

 

bEnableTouchOverEvents

Whether actor/component touch over events should be generated.

Public variable

uint32: 1

 

bForceFeedbackEnabled

Public variable

uint32: 1

 

bHidePawnInCinematicMode

When cinematic mode is true, signifies that this controller's pawn should be hidden

Public variable

uint32: 1

 

bIsUsingStreamingVolumes

Whether this controller is using streaming volumes.

Public variable

FRotator

 

BlendedTargetViewRotation

Smoothed version of TargetViewRotation to remove jerkiness from intermittent replication updates.

Protected variable

uint32: 1

 

bOverrideAudioAttenuationListener

Whether to override the attenuation listener position.

Protected variable

uint32: 1

 

bOverrideAudioListener

Whether to override the normal audio listener positioning method

Public variable

uint32: 1

 

bPlayerIsWaiting

True if PlayerController is currently waiting for the match to start or to respawn.

Public variable

bool

 

bRenderPrimitiveComponents

Whether to render primitives component.

Public variable

uint32: 1

 

bShortConnectTimeOut

When true, reduces connect timeout from InitialConnectionTimeOut to ConnectionTimeout.

Protected variable

uint32: 1

 

bShouldPerformFullTickWhenPaused

Whether we fully tick when the game is paused, if our tick function is allowed to do so.

Public variable

uint32: 1

 

bShowMouseCursor

Whether the mouse cursor should be displayed.

Public variable

TSubclassOf< UC...

 

CheatClass

Class of my CheatManager. The Cheat Manager is not created in shipping builds

Public variable

UCheatManager &...

 

CheatManager

Object that manages "cheat" commands. Not instantiated in shipping builds.

Public variable

TArray< FKey >

 

ClickEventKeys

List of keys that will cause click events to be forwarded, default to left click

Public variable

int32

 

ClientCap

Cap set by server on bandwidth from client to server in bytes/sec (only has impact if >=2600)

Public variable

UInterpTrackIns...

 

ControllingDirTrackInst

Director track that's currently possessing this player controller, or none if not possessed.

Protected variable

TWeakObjectPtr<...

 

CurrentClickablePrimitive

Clickable object currently under the mouse cursor.

Public variable

TEnumAsByte< EC...

 

CurrentClickTraceChannel

Trace channel currently being used for determining what world object was clicked on.

Protected variable

TArray< TWeakOb...

 

CurrentInputStack

  1. Current stack of InputComponents.

Public variable

TEnumAsByte< EM...

 

CurrentMouseCursor

Currently visible mouse cursor

Protected variable

TWeakObjectPtr<...

 

CurrentTouchablePrimitives

Touchable objects currently under fingers.

Protected variable

UTouchInterface...

 

CurrentTouchInterface

The currently set touch interface

Public variable

TEnumAsByte< EC...

 

DefaultClickTraceChannel

Default trace channel used for determining what world object was clicked on.

Public variable

TEnumAsByte< EM...

 

DefaultMouseCursor

Type of mouse cursor to show by default

Public variable

TArray< FForceF...

 

ForceFeedbackEffectHistoryEntries

For debugging, shows the last force feeback effects that played

Public variable

float

 

ForceFeedbackScale

Scale applied to force feedback values

Public variable

FForceFeedbackV...

 

ForceFeedbackValues

Currently active force feedback weights

Public variable

TArray< class A...

 

HiddenActors

The actors which the camera shouldn't see - e.g. used to hide actors which the camera penetrates

Public variable

TArray< TWeakOb...

 

HiddenPrimitiveComponents

Explicit components the camera shouldn't see (helpful for external systems to hide a component from a single player)

Public variable

float

 

HitResultTraceDistance

Distance to trace when computing click events

Protected variable

UInputComponent...

 

InactiveStateInputComponent

InputComponent we use when player is in Inactive state.

Public variable

float

 

InputPitchScale

Pitch input speed scaling

Public variable

float

 

InputRollScale

Roll input speed scaling

Public variable

float

 

InputYawScale

Yaw input speed scaling

Public variable

uint16

 

LastCompletedSeamlessTravelCount

The value of SeamlessTravelCount, upon the last call to GameModeBase::HandleSeamlessTravelPlayer; used to detect seamless travel

Protected variable

float

 

LastMovementHitch

Last real time (undilated) a hitch was detected in TickActor() when checking for forced client movement updates.

Protected variable

float

 

LastMovementUpdateTime

Last real time (undilated) recorded in TickActor() when checking for forced client movement updates.

Public variable

float

 

LastSpectatorStateSynchTime

Used to make sure the client is kept synchronized when in a spectator state

Public variable

FVector

 

LastSpectatorSyncLocation

Last location synced on the server for a spectator.

Public variable

FRotator

 

LastSpectatorSyncRotation

Last rotation synced on the server for a spectator.

Public variable

float

 

LocalPlayerCachedLODDistanceFactor

Last used FOV based multiplier to distance to an object when determining if it exceeds the object's cull distance

Public variable

FPlayerMuteList

 

MuteList

List of muted players in various categories

Public variable

AHUD *

 

MyHUD

Heads up display associated with this PlayerController.

Public variable

UNetConnection ...

 

NetConnection

The net connection this controller is communicating on, nullptr for local players on server

Public variable

uint8

 

NetPlayerIndex

Index identifying players using the same base connection (splitscreen clients) Used by netcode to match replicated PlayerControllers to the correct splitscreen viewport and child connection replicated via special internal code, not through normal variable replication

Public variable

TArray< FName >

 

PendingMapChangeLevelNames

List of names of levels the server is in the middle of sending us for a PrepareMapChange() call

Public variable

UNetConnection ...

 

PendingSwapConnection

This is set on the OLD PlayerController when performing a swap over a network connection so we know what connection we're waiting on acknowledgment from to finish destroying this PC (or when the connection is closed)

Public variable

UPlayer *

 

Player

UPlayer associated with this PlayerController.

Public variable

APlayerCameraMa...

 

PlayerCameraManager

Camera/view related variables Camera manager associated with this Player Controller.

Public variable

TSubclassOf< AP...

 

PlayerCameraManagerClass

PlayerCamera class should be set for each game, otherwise Engine.PlayerCameraManager is used

Public variable

UPlayerInput &#...

 

PlayerInput

Object that manages player input.

Public variable

FRotator

 

RotationInput

Input axes values, accumulated each tick.

Public variable

uint16

 

SeamlessTravelCount

Counter for this players seamless travels (used along with the below value, to restrict ServerNotifyLoadedWorld)

Public variable

float

 

SmoothTargetViewRotationSpeed

Interp speed for blending remote view rotation for smoother client updates

Protected variable

FVector

 

SpawnLocation

The location used internally when there is no pawn or spectator, to know where to spawn the spectator or focus the camera on death.

Public variable

FRotator

 

TargetViewRotation

Used to replicate the view rotation of targets not owned/possessed by this PlayerController.

Protected variable

FTimerHandle

 

TimerHandle_UnFreeze

Handle for efficient management of UnFreeze timer

Protected variable

TSharedPtr< cla...

 

VirtualJoystick

The virtual touch interface

Constructors

Name Description

Public function

APlayerController

(
    const FObjectInitializer& ObjectIn...
)

Default Constructor

Functions

Name Description

Public function Virtual

void

 

AcknowledgePossession

(
    APawn* P
)

Returns true if input should be frozen (whether UnFreeze timer is active)

Public function Virtual

void

 

ActivateTouchInterface

(
    UTouchInterface* NewTouchInter...
)

Activates a new touch interface for this player controller

Public function Virtual

void

 

AddCheats

(
    bool bForce
)

Notifies the server that the client has ticked gameplay code, and should no longer get the extended "still loading" timeout grace period

Public function Virtual

void

 

AddPitchInput

(
    float Val
)

Add Pitch (look up) input. This value is multiplied by InputPitchScale.

Public function Virtual

void

 

AddRollInput

(
    float Val
)

Add Roll input. This value is multiplied by InputRollScale.

Public function Virtual

void

 

AddYawInput

(
    float Val
)

Add Yaw (turn) input. This value is multiplied by InputYawScale.

Public function Virtual

void

 

AutoManageActiveCameraTarget

(
    AActor* SuggestedTarget
)

If bAutoManageActiveCameraTarget is true, then automatically manage the active camera target.

Protected function Virtual

void

 

BeginPlayingState()

Pawn has been possessed, so changing state to NAME_Playing.

Protected function Virtual

void

 

BeginSpectatingState()

Event when spectating begins.

Public function

void

 

BuildHiddenComponentList

(
    const FVector& ViewLocation,
    TSet< FPrimitiveComponentId >& Hid...
)

Builds a list of components that are hidden based upon gameplay.

Protected function Virtual

void

 

BuildInputStack

(
    TArray< UInputComponent* >& I...
)

Public function Virtual

void

 

Camera

(
    FName NewMode
)

Change Camera mode

Public function Virtual

bool

 

CanRestartPlayer()

Returns true if this controller thinks it's able to restart.

Public function Virtual

void

 

CleanUpAudioComponents()

Clears out 'left-over' audio components.

Public function Virtual

void

 

CleanupGameViewport()

Gives the PlayerController an opportunity to cleanup any changes it applied to the game viewport, primarily for the touch interface

Public function

void

 

ClearAudioListenerAttenuationOverride()

Public function

void

 

ClearAudioListenerOverride()

Clear any overrides that have been applied to audio listener

Public function

void

 

ClientAddTextureStreamingLoc

(
    FVector InLoc,
    float Duration,
    bool bOverrideLocation
)

Adds a location to the texture streaming system for the specified duration.

Public function

void

 

ClientCancelPendingMapChange()

Tells client to cancel any pending map change.

Public function

void

 

ClientCapBandwidth

(
    int32 Cap
)

Set CurrentNetSpeed to the lower of its current value and Cap.

Public function Virtual

void

 

ClientClearCameraLensEffects()

Removes all Camera Lens Effects.

Public function

void

 

ClientCommitMapChange()

Actually performs the level transition prepared by PrepareMapChange().

Public function Virtual

void

 

ClientEnableNetworkVoice

(
    bool bEnable
)

Tell the client to enable or disable voice chat (not muting)

Public function

void

 

ClientEndOnlineSession()

Notify client that the session is about to start

Public function

void

 

ClientFlushLevelStreaming()

Tells the client to block until all pending level streaming actions are complete happens at the end of the tick primarily used to force update the client ASAP at join time

Public function

void

 

ClientForceGarbageCollection()

Forces GC at the end of the tick on the client

Public function

void

 

ClientGameEnded

(
    AActor* EndGameFocus,
    bool bIsWinner
)

Replicated function called by GameHasEnded().

Public function

void

 

ClientGotoState

(
    FName NewState
)

Server uses this to force client into NewState .

Public function

void

 

ClientIgnoreLookInput

(
    bool bIgnore
)

Calls IgnoreLookInput on client

Public function

void

 

ClientIgnoreMoveInput

(
    bool bIgnore
)

Calls IgnoreMoveInput on client

Public function

void

 

ClientMessage

(
    const FString& S,
    FName Type,
    float MsgLifeTime
)

Outputs a message to HUD

Public function Virtual

void

 

ClientMutePlayer

(
    FUniqueNetIdRepl PlayerId
)

Tell the client to mute a player for this controller

Public function

void

 

ClientPlayCameraAnim

(
    UCameraAnim* AnimToPlay,
    float Scale,
    float Rate,
    float BlendInTime,
    float BlendOutTime,
    bool bLoop,
    bool bRandomStartTime,
    ECameraAnimPlaySpace::Type Space,
    FRotator CustomPlaySpace
)

Play the indicated CameraAnim on this camera.

Public function

void

 

ClientPlayCameraShake

(
    TSubclassOf< class UCameraShake > S...,
    float Scale,
    ECameraAnimPlaySpace::Type PlaySpac...,
    FRotator UserPlaySpaceRot
)

Play Camera Shake

Public function

void

 

ClientPlayCameraShakeFromSource

(
    TSubclassOf< class UCameraShake > S...,
    UCameraShakeSourceComponent* S...
)

Play Camera Shake localized to a given source

Public function

void

 

ClientPlayForceFeedback

(
    UForceFeedbackEffect* ForceFee...,
    FForceFeedbackParameters Params
)

Play a force feedback pattern on the player's controller

Public function

void

 

ClientPlaySound

(
    USoundBase* Sound,
    float VolumeMultiplier,
    float PitchMultiplier
)

Play sound client-side (so only the client will hear it)

Public function

void

 

ClientPlaySoundAtLocation

(
    USoundBase* Sound,
    FVector Location,
    float VolumeMultiplier,
    float PitchMultiplier
)

Play sound client-side at the specified location

Public function

void

 

ClientPrepareMapChange

(
    FName LevelName,
    bool bFirst,
    bool bLast
)

Asynchronously loads the given level in preparation for a streaming map transition.

Public function

void

 

ClientPrestreamTextures

(
    AActor* ForcedActor,
    float ForceDuration,
    bool bEnableStreaming,
    int32 CinematicTextureGroups
)

Forces the streaming system to disregard the normal logic for the specified duration and instead always load all mip-levels for all textures used by the specified actor.

Public function

void

 

ClientReceiveLocalizedMessage

(
    TSubclassOf< ULocalMessage > Messag...,
    int32 Switch,
    APlayerState* RelatedPlayerSta...,
    APlayerState* RelatedPlayerSta...,
    UObject* OptionalObject
)

Send client localized message id

Public function Virtual

void

 

ClientRepObjRef

(
    UObject* Object
)

Development RPC for testing object reference replication

Public function

void

 

ClientReset()

Tell client to reset the PlayerController

Public function

void

 

ClientRestart

(
    APawn* NewPawn
)

Tell client to restart the level

Public function

void

 

ClientRetryClientRestart

(
    APawn* NewPawn
)

Assign Pawn to player, but avoid calling ClientRestart if we have already accepted this pawn

Public function Virtual

void

 

ClientReturnToMainMenuWithTextReason

(
    const FText& ReturnReason
)

Return the client to the main menu gracefully

Public function

void

 

ClientSetBlockOnAsyncLoading()

Tells the client to block until all pending level streaming actions are complete.

Public function

void

 

ClientSetCameraFade

(
    bool bEnableFading,
    FColor FadeColor,
    FVector2D FadeAlpha,
    float FadeTime,
    bool bFadeAudio
)

Tell client to fade camera bEnableFading - true if we should apply FadeColor/FadeAmount to the screen FadeColor - Color to fade to FadeAlpha - Amount of fading to apply FadeTime - length of time for fade to occur over bFadeAudio - true to apply fading of audio alongside the video

Public function

void

 

ClientSetCameraMode

(
    FName NewCamMode
)

Replicated function to set camera style on client

Public function

void

 

ClientSetCinematicMode

(
    bool bInCinematicMode,
    bool bAffectsMovement,
    bool bAffectsTurning,
    bool bAffectsHUD
)

Called by the server to synchronize cinematic transitions with the client

Public function

void

 

ClientSetForceMipLevelsToBeResident

(
    UMaterialInterface* Material,
    float ForceDuration,
    int32 CinematicTextureGroups
)

Forces the streaming system to disregard the normal logic for the specified duration and instead always load all mip-levels for all textures used by the specified material.

Public function

void

 

ClientSetHUD

(
    TSubclassOf< AHUD > NewHUDClass
)

Set the client's class of HUD and spawns a new instance of it.

Public function

void

 

ClientSetSpectatorWaiting

(
    bool bWaiting
)

Indicate that the Spectator is waiting to join/respawn.

Public function

void

 

ClientSetViewTarget

(
    AActor* A,
    FViewTargetTransitionParams Transit...
)

Set the view target

Public function

void

 

ClientSpawnCameraLensEffect

(
    TSubclassOf< class AEmitterCameraLe...
)

Spawn a camera lens effect (e.g. blood).

Public function

void

 

ClientStartOnlineSession()

Notify client that the session is starting

Public function

void

 

ClientStopCameraAnim

(
    UCameraAnim* AnimToStop
)

Stop camera animation on client.

Public function

void

 

ClientStopCameraShake

(
    TSubclassOf< class UCameraShake > S...,
    bool bImmediately
)

Stop camera shake on client.

Public function

void

 

ClientStopCameraShakesFromSource

(
    UCameraShakeSourceComponent* S...,
    bool bImmediately
)

Stop camera shake on client.

Public function

void

 

ClientStopForceFeedback

(
    UForceFeedbackEffect* ForceFee...,
    FName Tag
)

Stops a playing force feedback pattern

Public function

void

 

ClientTeamMessage

(
    APlayerState* SenderPlayerStat...,
    const FString& S,
    FName Type,
    float MsgLifeTime
)

Public function

void

 

ClientTravel

(
    const FString& URL,
    enum ETravelType TravelType,
    bool bSeamless,
    FGuid MapPackageGuid
)

Travel to a different map or IP address.

Public function

void

 

ClientTravelInternal

(
    const FString& URL,
    enum ETravelType TravelType,
    bool bSeamless,
    FGuid MapPackageGuid
)

Internal clientside implementation of ClientTravel - use ClientTravel to call this

Public function Virtual

void

 

ClientUnmutePlayer

(
    FUniqueNetIdRepl PlayerId
)

Tell the client to unmute a player for this controller

Public function

void

 

ClientUpdateLevelStreamingStatus

(
    FName PackageName,
    bool bNewShouldBeLoaded,
    bool bNewShouldBeVisible,
    bool bNewShouldBlockOnLoad,
    int32 LODIndex
)

Replicated Update streaming status

Public function

void

 

ClientUpdateMultipleLevelsStreamingStatus

(
    const TArray< FUpdateLevelStreaming...
)

Replicated Update streaming status.

Public function Virtual

void

 

ClientVoiceHandshakeComplete()

Tells the client that the server has all the information it needs and that it is ok to start sending voice packets.

Public function

void

 

ClientWasKicked

(
    const FText& KickReason
)

Notify client they were kicked from the server

Public function Virtual

FString

 

ConsoleCommand

(
    const FString& Command,
    bool bWriteToLog
)

Executes the Exec() command on the UPlayer object

Public function Virtual

void

 

ConsoleKey

(
    FKey Key
)

Console control commands, useful when remote debugging so you can't touch the console the normal way

Public function Virtual

void

 

CreateTouchInterface()

Create the touch interface, and activate an initial touch interface (if touch interface is desired)

Public function Virtual

bool

 

DefaultCanUnpause()

Default implementation of pausing check for 'CanUnpause' delegates

Public function Virtual

void

 

DelayedPrepareMapChange()

Used to wait until a map change can be prepared when one was already in progress

Public function Const

bool

 

DeprojectMousePositionToWorld

(
    FVector& WorldLocation,
    FVector& WorldDirection
)

Convert current mouse 2D position to World Space 3D position and direction.

Public function Const

bool

 

DeprojectScreenPositionToWorld

(
    float ScreenX,
    float ScreenY,
    FVector& WorldLocation,
    FVector& WorldDirection
)

Convert 2D screen position to World Space 3D position and direction.

Protected function Virtual

void

 

DestroySpectatorPawn()

Destroys the SpectatorPawn and sets it to nullptr.

Public function Virtual

void

 

EnableCheats()

Enables cheats within the game

Protected function Virtual

void

 

EndPlayingState()

Leave playing state.

Protected function Virtual

void

 

EndSpectatingState()

Event when no longer spectating.

Public function Virtual

void

 

FlushPressedKeys()

Flushes the current key state.

Public function

void

 

ForceSingleNetUpdateFor

(
    AActor* Target
)

Forces a full replication check of the specified Actor on only the client that owns this PlayerController this function has no effect if this PC is not a remote client or if the Actor is not relevant to that client

Public function Virtual

void

 

FOV

(
    float NewFOV
)

Set the field of view to NewFOV

Public function

void

 

GameplayMutePlayer

(
    const FUniqueNetIdRepl& PlayerNetI...
)

Mutes a remote player on the server and then tells the client to mute

Public function

void

 

GameplayUnmutePlayer

(
    const FUniqueNetIdRepl& PlayerNetI...
)

Unmutes a remote player on the server and then tells the client to unmute

Public function Virtual Const

bool

 

GetAudioListenerAttenuationOverridePosition

(
    FVector& OutLocation
)

Gets the attenuation position override.

Public function Virtual Const

void

 

GetAudioListenerPosition

(
    FVector& OutLocation,
    FVector& OutFrontDir,
    FVector& OutRightDir
)

Get audio listener position and orientation

Protected function Virtual Const

ACameraActor...

 

GetAutoActivateCameraForPlayer()

Public function

UInterpTrack...

 

GetControllingDirector()

Returns the Matinee director track that's currently possessing this player controller, or nullptr for none

Public function Virtual Const

FVector

 

GetFocalLocation()

Returns the location the PlayerController is focused on.

Public function Const

bool

 

GetHitResultAtScreenPosition

(
    const FVector2D ScreenPosition,
    const ECollisionChannel TraceChanne...,
    const FCollisionQueryParams& Colli...,
    FHitResult& HitResult
)

Returns hit results from doing a collision query at a certain location on the screen

Public function Const

bool

 

GetHitResultAtScreenPosition

(
    const FVector2D ScreenPosition,
    const ECollisionChannel TraceChanne...,
    bool bTraceComplex,
    FHitResult& HitResult
)

Returns hit results from doing a collision query at a certain location on the screen

Public function Const

bool

 

GetHitResultAtScreenPosition

(
    const FVector2D ScreenPosition,
    const ETraceTypeQuery TraceChannel,
    bool bTraceComplex,
    FHitResult& HitResult
)

Returns hit results from doing a collision query at a certain location on the screen

Public function Const

bool

 

GetHitResultAtScreenPosition

(
    const FVector2D ScreenPosition,
    const TArray< TEnumAsByte< EObjectT...,
    bool bTraceComplex,
    FHitResult& HitResult
)

Returns hit results from doing a collision query at a certain location on the screen

Public function Const

bool

 

GetHitResultUnderCursor

(
    ECollisionChannel TraceChannel,
    bool bTraceComplex,
    FHitResult& HitResult
)

Public function Const

bool

 

GetHitResultUnderCursorByChannel

(
    ETraceTypeQuery TraceChannel,
    bool bTraceComplex,
    FHitResult& HitResult
)

Performs a collision query under the mouse cursor, looking on a trace channel

Public function Const

bool

 

GetHitResultUnderCursorForObjects

(
    const TArray< TEnumAsByte< EObjectT...,
    bool bTraceComplex,
    FHitResult& HitResult
)

Performs a collision query under the mouse cursor, looking for object types

Public function Const

bool

 

GetHitResultUnderFinger

(
    ETouchIndex::Type FingerIndex,
    ECollisionChannel TraceChannel,
    bool bTraceComplex,
    FHitResult& HitResult
)

Public function Const

bool

 

GetHitResultUnderFingerByChannel

(
    ETouchIndex::Type FingerIndex,
    ETraceTypeQuery TraceChannel,
    bool bTraceComplex,
    FHitResult& HitResult
)

Performs a collision query under the finger, looking on a trace channel

Public function Const

bool

 

GetHitResultUnderFingerForObjects

(
    ETouchIndex::Type FingerIndex,
    const TArray< TEnumAsByte< EObjectT...,
    bool bTraceComplex,
    FHitResult& HitResult
)

Performs a collision query under the finger, looking for object types

Public function Const

T *

 

GetHUD()

Templated version of GetHUD, will return nullptr if cast fails

Public function Const

AHUD *

 

GetHUD()

Gets the HUD currently being used by this player controller

Public function Const

float

 

GetInputAnalogKeyState

(
    FKey Key
)

Returns the analog value for the given key/button.

Public function Const

void

 

GetInputAnalogStickState

(
    EControllerAnalogStick::Type WhichS...,
    float& StickX,
    float& StickY
)

Retrieves the X and Y displacement of the given analog stick.

Protected function Virtual Const

int32

 

GetInputIndex()

Public function Const

float

 

GetInputKeyTimeDown

(
    FKey Key
)

Returns how long the given key/button has been down.

Public function Const

void

 

GetInputMotionState

(
    FVector& Tilt,
    FVector& RotationRate,
    FVector& Gravity,
    FVector& Acceleration
)

Retrieves the current motion state of the player's input device

Public function Const

void

 

GetInputMouseDelta

(
    float& DeltaX,
    float& DeltaY
)

Retrieves how far the mouse moved this frame.

Public function Const

void

 

GetInputTouchState

(
    ETouchIndex::Type FingerIndex,
    float& LocationX,
    float& LocationY,
    bool& bIsCurrentlyPressed
)

Retrieves the X and Y screen coordinates of the specified touch key.

Public function Const

FVector

 

GetInputVectorKeyState

(
    FKey Key
)

Returns the vector value for the given key/button.

Public function Const

ULocalPlayer...

 

GetLocalPlayer()

Returns the ULocalPlayer for this controller if it exists, or null otherwise

Public function Virtual

float

 

GetMinRespawnDelay()

Calculate minimal respawn delay

Public function Virtual Const

EMouseCursor...

 

GetMouseCursor()

Returns the current mouse cursor, or None

Public function Const

bool

 

GetMousePosition

(
    float& LocationX,
    float& LocationY
)

Retrieves the X and Y screen coordinates of the mouse cursor.

Public function Virtual

APlayerState...

 

GetNextViewablePlayer

(
    int32 dir
)

Get next active viewable player in PlayerArray.

Public function Const

APawn *

 

GetPawnOrSpectator()

Returns the first of GetPawn() or GetSpectatorPawn() that is not nullptr, or nullptr otherwise.

Public function Virtual

APlayerContr...

 

GetPlayerControllerForMuting

(
    const FUniqueNetIdRepl& PlayerNetI...
)

Get a remote player controller on the server for muting

Public function

FString

 

GetPlayerNetworkAddress()

Get the local players network address

Public function Virtual

void

 

GetSeamlessTravelActorList

(
    bool bToEntry,
    TArray< class AActor* >& Acto...
)

Called on client during seamless level transitions to get the list of Actors that should be moved into the new level PlayerControllers, Role < ROLE_Authority Actors, and any non-Actors that are inside an Actor that is in the list (i.e. Object.Outer == Actor in the list) are all automatically moved regardless of whether they're included here only dynamic actors in the PersistentLevel may be moved (this includes all actors spawned during gameplay) this is called for both parts of the transition because actors might change while in the middle (e.g. players might join or leave the game)

Public function

FString

 

GetServerNetworkAddress()

Get the server network address

Public function Const

FVector

 

GetSpawnLocation()

Get the location used when initially created, or when changing states when there is no pawn or spectator.

Public function Const

ASpectatorPa...

 

GetSpectatorPawn()

Get the Pawn used when spectating. nullptr when not spectating.

Public function Const

APlayerState...

 

GetSplitscreenPlayerByIndex

(
    int32 PlayerIndex
)

Returns the PlayerState associated with the player at the specified index.

Public function Const

int32

 

GetSplitscreenPlayerCount()

Returns the number of split-screen players playing on this player's machine.

Public function Const

void

 

GetViewportSize

(
    int32& SizeX,
    int32& SizeY
)

Helper to get the size of the HUD canvas for this player controller. Returns 0 if there is no HUD

Public function

bool

 

HasClientLoadedCurrentWorld()

Returns whether the client has completely loaded the server's current world (valid on server only)

Public function Virtual

void

 

InitInputSystem()

Spawn the appropriate class of PlayerInput.

Public function Virtual

bool

 

InputAxis

(
    FKey Key,
    float Delta,
    float DeltaTime,
    int32 NumSamples,
    bool bGamepad
)

Handles a controller axis input

Public function Const

bool

 

InputEnabled()

Public function Virtual

bool

 

InputKey

(
    FKey Key,
    EInputEvent EventType,
    float AmountDepressed,
    bool bGamepad
)

Handles a key press

Public function Virtual

bool

 

InputMotion

(
    const FVector& Tilt,
    const FVector& RotationRate,
    const FVector& Gravity,
    const FVector& Acceleration
)

Handles motion control

Public function Virtual

bool

 

InputTouch

(
    uint32 Handle,
    ETouchType::Type Type,
    const FVector2D& TouchLocation,
    float Force,
    FDateTime DeviceTimestamp,
    uint32 TouchpadIndex
)

Handles a touch screen action

Public function Virtual

bool

 

IsFrozen()

Returns true if input should be frozen (whether UnFreeze timer is active)

Public function Const

bool

 

IsInputKeyDown

(
    FKey Key
)

Returns true if the given key/button is pressed on the input of the controller (if present)

Protected function Virtual Const

bool

 

IsInViewportClient

(
    UGameViewportClient* ViewportC...
)

Public function Const

bool

 

IsPaused()

Returns true if game is currently paused.

Public function Virtual

bool

 

IsPlayerMuted

(
    const FUniqueNetId& PlayerId
)

Is the specified player muted by this controlling player for any reason (gameplay, system, etc), check voice interface IsMuted() for system mutes

Public function Const

bool

 

IsPrimaryPlayer()

Wrapper for determining whether this player is the first player on their console.

Public function Const

bool

 

IsSplitscreenPlayer

(
    int32* OutSplitscreenPlayerInd...
)

Determines whether this player is playing split-screen.

Public function

void

 

K2_ClientPlayForceFeedback

(
    UForceFeedbackEffect* ForceFee...,
    FName Tag,
    bool bLooping,
    bool bIgnoreTimeDilation,
    bool bPlayWhilePaused
)

Play a force feedback pattern on the player's controller

Public function

void

 

LevelStreamingStatusChanged

(
    ULevelStreaming* LevelObject,
    bool bNewShouldBeLoaded,
    bool bNewShouldBeVisible,
    bool bNewShouldBlockOnLoad,
    int32 LODIndex
)

Notify player of change to level

Public function Virtual

void

 

LocalTravel

(
    const FString& URL
)

Causes the client to travel to the given URL

Public function

FName

 

NetworkRemapPath

(
    FName InPackageName,
    bool bReading
)

Handles remapping a package name for networking, call on both the client and server when sending package names manually for RPCs

Public function Virtual

void

 

NotifyActorChannelFailure

(
    UActorChannel* ActorChan
)

Called on the server when the client sends a message indicating it was unable to initialize an Actor channel, most commonly because the desired Actor's archetype couldn't be serialized the default is to do nothing (Actor simply won't exist on the client), but this function gives the game code an opportunity to try to correct the problem

Public function Virtual

void

 

NotifyDirectorControl

(
    bool bNowControlling,
    AMatineeActor* CurrentMatinee
)

Notification when a matinee director track starts or stops controlling the ViewTarget of this PlayerController

Public function Virtual

void

 

NotifyLoadedWorld

(
    FName WorldPackageName,
    bool bFinalDest
)

Called to notify the server when the client has loaded a new world via seamless traveling

Public function Virtual

bool

 

NotifyServerReceivedClientData

(
    APawn* InPawn,
    float TimeStamp
)

Notify the server that client data was received on the Pawn.

Public function

void

 

OnServerStartedVisualLogger

(
    bool bIsLogging
)

Notify from server that Visual Logger is recording, to show that information on client about possible performance issues

Public function Virtual

void

 

Pause()

Command to try to pause the game.

Public function Virtual

void

 

PawnLeavingGame()

Clean up when a Pawn's player is leaving a game. Base implementation destroys the pawn.

Public function

FDynamicForc...

 

PlayDynamicForceFeedback

(
    float Intensity,
    float Duration,
    bool bAffectsLeftLarge,
    bool bAffectsLeftSmall,
    bool bAffectsRightLarge,
    bool bAffectsRightSmall,
    EDynamicForceFeedbackAction::Type A...,
    FDynamicForceFeedbackHandle ActionH...
)

Allows playing of a dynamic force feedback event from native code Begins playing when Start is called.

Public function Virtual

void

 

PlayerTick

(
    float DeltaTime
)

Processes player input (immediately after PlayerInput gets ticked) and calls UpdateRotation().

Public function

void

 

PlayHapticEffect

(
    UHapticFeedbackEffect_Base* Ha...,
    EControllerHand Hand,
    float Scale,
    bool bLoop
)

Play a haptic feedback curve on the player's controller

Public function Virtual

bool

 

PopInputComponent

(
    UInputComponent* Input
)

Removes given inputcomponent from the input stack (regardless of if it's the top, actually).

Public function Virtual

void

 

PostProcessInput

(
    const float DeltaTime,
    const bool bGamePaused
)

Method called after processing input

Public function Virtual Const

bool

 

PostProcessWorldToScreen

(
    FVector WorldLocation,
    FVector2D& ScreenLocation,
    bool bPlayerViewportRelative
)

After successful world to screen projection, allows custom post-processing of the resulting ScreenLocation.

Public function Virtual

void

 

PostSeamlessTravel()

Called after this player controller has transitioned through seamless travel, but before that player is initialized This is called both when a new player controller is created, and when it is maintained

Public function Virtual

void

 

PreClientTravel

(
    const FString& PendingURL,
    ETravelType TravelType,
    bool bIsSeamlessTravel
)

Called when the local player is about to travel to a new map or IP address.

Public function Virtual

void

 

PreProcessInput

(
    const float DeltaTime,
    const bool bGamePaused
)

Method called prior to processing input

Protected function

void

 

ProcessForceFeedbackAndHaptics

(
    const float DeltaTime,
    const bool bGamePaused
)

Protected function Virtual

void

 

ProcessPlayerInput

(
    const float DeltaTime,
    const bool bGamePaused
)

Public function Const

bool

 

ProjectWorldLocationToScreen

(
    FVector WorldLocation,
    FVector2D& ScreenLocation,
    bool bPlayerViewportRelative
)

Convert a World Space 3D position into a 2D Screen Space position.

Public function Const

bool

 

ProjectWorldLocationToScreenWithDistance

(
    FVector WorldLocation,
    FVector& ScreenLocation,
    bool bPlayerViewportRelative
)

Convert a World Space 3D position into a 3D Screen Space position.

Public function Virtual

void

 

PushInputComponent

(
    UInputComponent* Input
)

Adds an inputcomponent to the top of the input stack.

Public function Virtual

void

 

ReceivedGameModeClass

(
    TSubclassOf< class AGameModeBase > ...
)

This function will be called to notify the player controller that the world has received its game class.

Public function Virtual

void

 

ReceivedPlayer()

Called after this PlayerController's viewport/net connection is associated with this player controller.

Public function Virtual

void

 

ReceivedSpectatorClass

(
    TSubclassOf< ASpectatorPawn > Spect...
)

Called to notify the controller that the spectator class has been received.

Public function Virtual

void

 

ResetCameraMode()

Reset Camera Mode to default.

Public function

void

 

ResetControllerLightColor()

Resets the light color of the player's controller to default

Public function Virtual

void

 

RestartLevel()

Restarts the current level

Public function Virtual

void

 

SafeRetryClientRestart()

Call ClientRetryClientRestart, but only if the current pawn is not the currently acknowledged pawn (and throttled to avoid saturating the network).

Public function Virtual

void

 

SafeServerCheckClientPossession()

Call ServerCheckClientPossession on the server, but only if the current pawn is not the acknowledged pawn (and throttled to avoid saturating the network).

Public function

void

 

SafeServerUpdateSpectatorState()

Calls ServerSetSpectatorLocation but throttles it to reduce bandwidth and only calls it when necessary.

Public function Virtual

void

 

SeamlessTravelFrom

(
    APlayerController* OldPC
)

Called when seamless traveling and the specified PC is being replaced by this one copy over data that should persist (not called if PlayerController is the same for the from and to GameModes)

Public function Virtual

void

 

SeamlessTravelTo

(
    APlayerController* NewPC
)

Called when seamless traveling and we are being replaced by the specified PC clean up any persistent state (post process chains on LocalPlayers, for example) (not called if PlayerController is the same for the from and to GameModes)

Public function Virtual

void

 

SendClientAdjustment()

Called on server at end of tick, to let client Pawns handle updates from the server.

Public function Virtual

void

 

SendToConsole

(
    const FString& Command
)

Sends a command to the console to execute if not shipping version

Public function

void

 

ServerAcknowledgePossession

(
    APawn* P
)

Acknowledge possession of pawn

Public function

void

 

ServerCamera

(
    FName NewMode
)

Change mode of camera

Public function

void

 

ServerChangeName

(
    const FString& S
)

Change name of server

Public function

void

 

ServerCheckClientPossession()

Tells the server to make sure the possessed pawn is in sync with the client.

Public function

void

 

ServerCheckClientPossessionReliable()

Reliable version of ServerCheckClientPossession to be used when there is no likely danger of spamming the network.

Public function

void

 

ServerExec

(
    const FString& Msg
)

Executes command on server (non shipping builds only)

Public function

void

 

ServerExecRPC

(
    const FString& Msg
)

RPC used by ServerExec. Not intended to be called directly

Public function Virtual

void

 

ServerMutePlayer

(
    FUniqueNetIdRepl PlayerId
)

Tell the server to mute a player for this controller

Public function

void

 

ServerNotifyLoadedWorld

(
    FName WorldPackageName
)

Called to notify the server when the client has loaded a new world via seamless traveling

Public function

void

 

ServerPause()

Replicate pause request to the server

Public function

void

 

ServerRestartPlayer()

Attempts to restart this player, generally called from the client upon respawn request.

Public function

void

 

ServerSetSpectatorLocation

(
    FVector NewLoc,
    FRotator NewRot
)

When spectating, updates spectator location/rotation and pings the server to make sure spectating should continue.

Public function

void

 

ServerSetSpectatorWaiting

(
    bool bWaiting
)

Indicate that the Spectator is waiting to join/respawn.

Public function

void

 

ServerShortTimeout()

Notifies the server that the client has ticked gameplay code, and should no longer get the extended "still loading" timeout grace period

Public function

void

 

ServerToggleAILogging()

Used by UGameplayDebuggingControllerComponent to replicate messages for AI debugging in network games.

Public function Virtual

void

 

ServerUnmutePlayer

(
    FUniqueNetIdRepl PlayerId
)

Tell the server to unmute a player for this controller

Public function

void

 

ServerUpdateCamera

(
    FVector_NetQuantize CamLoc,
    int32 CamPitchAndYaw
)

  • combine pitch/yaw into one int, maybe also send location compressed

Public function

void

 

ServerUpdateLevelVisibility

(
    const FUpdateLevelVisibilityLevelIn...
)

Called when the client adds/removes a streamed level.

Public function

void

 

ServerUpdateMultipleLevelsVisibility

(
    const TArray< FUpdateLevelVisibilit...
)

Called when the client adds/removes a streamed level.

Public function

void

 

ServerVerifyViewTarget()

Used by client to request server to confirm current viewtarget (server will respond with ClientSetViewTarget() ).

Public function

void

 

ServerViewNextPlayer()

Move camera to next player on round ended or spectating

Public function

void

 

ServerViewPrevPlayer()

Move camera to previous player on round ended or spectating

Public function

void

 

ServerViewSelf

(
    FViewTargetTransitionParams Transit...
)

Move camera to current user

Public function

void

 

SetAsLocalPlayerController()

Designate this player controller as local (public for GameModeBase to use, not expected to be called anywhere else)

Public function

void

 

SetAudioListenerAttenuationOverride

(
    USceneComponent* AttachToCompo...,
    FVector AttenuationLocationOVerride
)

Public function

void

 

SetAudioListenerOverride

(
    USceneComponent* AttachToCompo...,
    FVector Location,
    FRotator Rotation
)

Used to override the default positioning of the audio listener

Public function Virtual

void

 

SetCameraMode

(
    FName NewCamMode
)

Set new camera mode

Public function Virtual

void

 

SetCinematicMode

(
    bool bInCinematicMode,
    bool bHidePlayer,
    bool bAffectsHUD,
    bool bAffectsMovement,
    bool bAffectsTurning
)

Server/SP only function for changing whether the player is in cinematic mode.

Public function Virtual

void

 

SetCinematicMode

(
    bool bInCinematicMode,
    bool bAffectsMovement,
    bool bAffectsTurning
)

Adjust input based on cinematic mode

Public function

void

 

SetControllerLightColor

(
    FColor Color
)

Sets the light color of the player's controller

Public function

void

 

SetControllingDirector

(
    UInterpTrackInstDirector* NewC...,
    bool bClientSimulatingViewTarget
)

Sets the Matinee director track instance that's currently possessing this player controller

Public function Virtual

void

 

SetDisableHaptics

(
    bool bNewDisabled
)

Allows the player controller to disable all haptic requests from being fired, e.g. in the case of a level loading

Public function

void

 

SetHapticsByValue

(
    const float Frequency,
    const float Amplitude,
    EControllerHand Hand
)

Sets the value of the haptics for the specified hand directly, using frequency and amplitude.

Public function Virtual

void

 

SetInputMode

(
    const FInputModeDataBase& InData
)

Setup an input mode.

Public function

void

 

SetMouseCursorWidget

(
    EMouseCursor::Type Cursor,
    UUserWidget* CursorWidget
)

Sets the Widget for the Mouse Cursor to display

Public function

void

 

SetMouseLocation

(
    const int X,
    const int Y
)

Positions the mouse cursor in screen space, in pixels.

Public function Virtual

void

 

SetName

(
    const FString& S
)

Tries to set the player's name to the given name.

Public function

void

 

SetNetSpeed

(
    int32 NewSpeed
)

Store the net speed

Public function Virtual

bool

 

SetPause

(
    bool bPause,
    FCanUnpause CanUnpauseDelegate
)

Locally try to pause game (call serverpause to pause network game); returns success indicator.

Public function Virtual

void

 

SetPlayer

(
    UPlayer* InPlayer
)

Associate a new UPlayer with this PlayerController.

Protected function Virtual

void

 

SetSpawnLocation

(
    const FVector& NewLocation
)

Set the SpawnLocation for use when changing states or when there is no pawn or spectator.

Protected function Virtual

void

 

SetSpectatorPawn

(
    ASpectatorPawn* NewSpectatorPa...
)

Set the spectator pawn.

Protected function Virtual

void

 

SetupInactiveStateInputComponent

(
    UInputComponent* InComponent
)

Sets up input bindings for the input component pushed on the stack in the inactive state.

Protected function Virtual

void

 

SetupInputComponent()

Allows the PlayerController to set up custom input bindings.

Public function Virtual

void

 

SetViewTarget

(
    AActor* NewViewTarget,
    FViewTargetTransitionParams Transit...
)

Set the view target

Public function Virtual

void

 

SetViewTargetWithBlend

(
    AActor* NewViewTarget,
    float BlendTime,
    enum EViewTargetBlendFunction Blend...,
    float BlendExp,
    bool bLockOutgoing
)

Set the view target blending with variable control

Public function Virtual

void

 

SetVirtualJoystickVisibility

(
    bool bVisible
)

Set the virtual joystick visibility.

Protected function Virtual Const

bool

 

ShouldKeepCurrentPawnUponSpectating()

Useful to spectate other pawn without un-possessing the current pawn

Public function Const

bool

 

ShouldPerformFullTickWhenPaused()

Returns true if we fully tick when paused (and if our tick function is enabled when paused).

Public function Virtual Const

bool

 

ShouldShowMouseCursor()

Returns true if the mouse cursor should be shown

Public function Virtual

void

 

SmoothTargetViewRotation

(
    APawn* TargetPawn,
    float DeltaSeconds
)

Called client-side to smoothly interpolate received TargetViewRotation (result is in BlendedTargetViewRotation)

Public function Virtual

void

 

SpawnDefaultHUD()

Spawn a HUD (make sure that PlayerController always has valid HUD, even if ClientSetHUD() hasn't been called

Public function Virtual

void

 

SpawnPlayerCameraManager()

Spawn cameras for servers and owning players

Protected function Virtual

ASpectatorPa...

 

SpawnSpectatorPawn()

Spawn a SpectatorPawn to use as a spectator and initialize it.

Public function Virtual

void

 

StartFire

(
    uint8 FireModeNum
)

Fire the player's currently selected weapon with the optional firemode.

Public function Virtual

void

 

StartSpectatingOnly()

Start spectating mode, as the only mode allowed.

Public function

void

 

StartTalking()

Enable voice chat transmission

Public function

void

 

StopHapticEffect

(
    EControllerHand Hand
)

Stops a playing haptic feedback curve

Public function

void

 

StopTalking()

Disable voice chat transmission

Public function Virtual

void

 

SwitchLevel

(
    const FString& URL
)

SwitchLevel to the given MapURL.

Protected function

void

 

TickPlayerInput

(
    const float DeltaSeconds,
    const bool bGamePaused
)

Internal.

Public function Virtual

void

 

ToggleSpeaking

(
    bool bInSpeaking
)

Toggle voice chat on and off

Public function Virtual

void

 

UnFreeze()

Timer used by RoundEnded and Inactive states to accept player input again

Public function Virtual

void

 

UpdateCameraManager

(
    float DeltaSeconds
)

Update the camera manager; this is called after all actors have been ticked.

Protected function Virtual

void

 

UpdateForceFeedback

(
    IInputInterface* InputInterfac...,
    const int32 ControllerId
)

Public function Virtual

void

 

UpdateHiddenActors

(
    const FVector& ViewLocation
)

Builds a list of actors that are hidden based upon gameplay

Public function Virtual

void

 

UpdateHiddenComponents

(
    const FVector& ViewLocation,
    TSet< FPrimitiveComponentId >&
)

Builds a list of components that are hidden based upon gameplay

Public function Virtual

void

 

UpdatePing

(
    float InPing
)

Takes ping updates from the net driver (both clientside and serverside), and passes them on to PlayerState::UpdatePing

Public function Virtual

void

 

UpdateRotation

(
    float DeltaTime
)

Updates the rotation of player, based on ControlRotation after RotationInput has been applied.

Protected function Virtual

void

 

UpdateStateInputComponents()

Refresh state specific input components

Public function Virtual

void

 

ViewAPlayer

(
    int32 dir
)

View next active player in PlayerArray.

Public function Const

bool

 

WasInputKeyJustPressed

(
    FKey Key
)

Returns true if the given key/button was up last frame and down this frame.

Public function Const

bool

 

WasInputKeyJustReleased

(
    FKey Key
)

Returns true if the given key/button was down last frame and up this frame.

Overridden from AController

Name Description

Public function Virtual

void

 

BeginInactiveState()

State entered when inactive (no possessed pawn, not spectating, etc).

Public function Virtual

void

 

ChangeState

(
    FName NewState
)

Change the current state to named state

Public function Virtual

void

 

CleanupPlayerState()

Called from Destroyed().

Public function Virtual

void

 

DisplayDebug

(
    UCanvas* Canvas,
    const FDebugDisplayInfo& DebugDisp...,
    float& YL,
    float& YPos
)

Public function Virtual

void

 

EndInactiveState()

Called when leaving the inactive state

Public function Virtual

void

 

FailedToSpawnPawn()

GameMode failed to spawn pawn for me.

Public function Virtual

void

 

GameHasEnded

(
    AActor* EndGameFocus,
    bool bIsWinner
)

Called from game mode upon end of the game, used to transition to proper state.

Public function Virtual Const

void

 

GetPlayerViewPoint

(
    FVector& Location,
    FRotator& Rotation
)

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

Public function Virtual Const

AActor *

 

GetViewTarget()

Get the actor the controller is looking at

Public function Virtual Const

bool

 

IsLocalController()

Returns whether this Controller is a local controller.

Protected function Virtual

void

 

OnPossess

(
    APawn* InPawn
)

Overridable native function for when this controller possesses a pawn.

Protected function Virtual

void

 

OnUnPossess()

Overridable native function for when this controller unpossesses its pawn.

Public function Virtual

void

 

ResetIgnoreInputFlags()

Reset move and look input ignore flags to defaults

Public function Virtual

void

 

SetInitialLocationAndRotation

(
    const FVector& NewLocation,
    const FRotator& NewRotation
)

Set the initial location and rotation of the controller, as well as the control rotation.

Public function Virtual

void

 

SetPawn

(
    APawn* InPawn
)

Setter for Pawn. Normally should only be used internally when possessing/unpossessing a Pawn.

Overridden from AActor

Name Description

Protected function Virtual

void

 

BeginPlay()

Overridable native event for when play begins for this actor.

Public function Virtual

void

 

CalcCamera

(
    float DeltaTime,
    FMinimalViewInfo& OutResult
)

Calculate camera view point, when viewing this actor.

Public function Virtual

void

 

Destroyed()

Called when this actor is explicitly being destroyed during gameplay or in the editor, not called during level streaming or gameplay ending

Public function Virtual

bool

 

DestroyNetworkActorHandled()

Called by DestroyActor(), gives actors a chance to op out of actor destruction Used by network code to have the net connection timeout/cleanup first

Public function Virtual

void

 

DisableInput

(
    APlayerController* PlayerContr...
)

Removes this actor from the stack of input being handled by a PlayerController.

Public function Virtual

void

 

EnableInput

(
    APlayerController* PlayerContr...
)

Pushes this actor on to the stack of input being handled by a PlayerController.

Public function Virtual

void

 

EndPlay

(
    const EEndPlayReason::Type EndPlayR...
)

Overridable function called whenever this actor is being removed from a level

Public function Virtual

void

 

FellOutOfWorld

(
    const UDamageType& dmgType
)

Called when the actor falls out of the world 'safely' (below KillZ and such)

Public function Virtual Const

void

 

GetActorEyesViewPoint

(
    FVector& OutLocation,
    FRotator& OutRotation
)

Returns the point of view of the actor.

Public function Virtual Const

UNetConnecti...

 

GetNetConnection()

Get the owning connection used for communicating between client/server

Public function Virtual Const

const AActor...

 

GetNetOwner()

Return the actor responsible for replication, if any. Typically the player controller

Public function Virtual

UPlayer *...

 

GetNetOwningPlayer()

Return the owning UPlayer (if any) of this actor.

Public function Virtual

float

 

GetNetPriority

(
    const FVector& ViewPos,
    const FVector& ViewDir,
    AActor* Viewer,
    AActor* ViewTarget,
    UActorChannel* InChannel,
    float Time,
    bool bLowBandwidth
)

Function used to prioritize actors when deciding which to replicate

Protected function Virtual Const

bool

 

HasNetOwner()

Overridden to return that player controllers are capable of RPCs

Public function Virtual Const

bool

 

IsNetRelevantFor

(
    const AActor* RealViewer,
    const AActor* ViewTarget,
    const FVector& SrcLocation
)

Checks to see if this actor is relevant for a specific network connection

Public function Virtual

void

 

OnActorChannelOpen

(
    FInBunch& InBunch,
    UNetConnection* Connection
)

Allows for a specific response from the actor when the actor channel is opened (client side)

Public function Virtual

void

 

OnNetCleanup

(
    UNetConnection* Connection
)

Handles cleaning up the associated Actor when killing the connection

Public function Virtual

void

 

OnSerializeNewActor

(
    FOutBunch& OutBunch
)

SerializeNewActor has just been called on the actor before network replication (server side)

Public function Virtual

void

 

PostInitializeComponents()

Overridden to create the player replication info and perform other mundane initialization tasks.

Public function Virtual

void

 

Reset()

Reset actor to initial state - used when restarting level without reloading.

Public function Virtual

void

 

TickActor

(
    float DeltaTime,
    enum ELevelTick TickType,
    FActorTickFunction& ThisTickFuncti...
)

Dispatches the once-per frame Tick() function for this actor

Public function Virtual Const

bool

 

UseShortConnectTimeout()

Used by the net connection to determine if a net owning actor should switch to using the shortened timeout value

Overridden from UObject

Name Description

Public function Virtual Const

void

 

GetLifetimeReplicatedProps

(
    TArray< FLifetimeProperty >& OutLi...
)

Returns the properties used for network replication, this needs to be overridden by all actor classes with native replicated properties

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Deprecated Functions

Name Description

Public function

void

 

ClientPlayForceFeedback

(
    UForceFeedbackEffect* ForceFee...,
    bool bLooping,
    bool bIgnoreTimeDilation,
    FName Tag
)

Use version that specifies parameters using a struct instead of a list of parameters

Public function

void

 

ClientPlayForceFeedback

(
    UForceFeedbackEffect* ForceFee...,
    bool bLooping,
    FName Tag
)

Use version that specifies parameters using a struct instead of a list of parameters

Public function Virtual

void

 

ClientReturnToMainMenu

(
    const FString& ReturnReason
)

As an FString, the ReturnReason parameter is not easily localized. Please use ClientReturnToMainMenuWithTextReason instead.

Public function

bool

 

InputTouch

(
    uint32 Handle,
    ETouchType::Type Type,
    const FVector2D& TouchLocation,
    FDateTime DeviceTimestamp,
    uint32 TouchpadIndex
)

InputTouch now takes a Force

Public function

void

 

ServerUpdateLevelVisibility

(
    FName PackageName,
    bool bIsVisible
)

Use ServerUpdateLevelVisibility that accepts a LevelVisibility struct.

See Also

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss