APlayerController

Inheritance Hierarchy

AController

APlayerController

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

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

Protected variable

uint32: 1

 

bCinemaDisableInputLook

Protected variable

uint32: 1

 

bCinemaDisableInputMove

The state of the inputs from cinematic mode

Protected variable

uint32: 1

 

bOverrideAudioListener

Whether to override the normal audio listener positioning method

Protected variable

uint32: 1

 

bShouldPerformFullTickWhenPaused

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

Protected variable

TWeakObjectPtr <...

 

CurrentClickablePrimitive

Clickable object currently under the mouse cursor.

Protected variable

TArray < TWeakOb ...

 

CurrentInputStack

Internal. Current stack of InputComponents.

Protected variable

TWeakObjectPtr <...

 

CurrentTouchablePrimitives

Touchable objects currently under fingers.

Protected variable

UTouchInterface...

 

CurrentTouchInterface

The currently set touch interface

Protected variable

UInputComponent...

 

InactiveStateInputComponent

InputComponent we use when player is in Inactive state.

Public variable

uint16

 

LastCompletedSeamlessTravelCount

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

Public variable

uint16

 

SeamlessTravelCount

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

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.

Protected variable

FTimerHandle

 

TimerHandle_UnFreeze

Handle for efficient management of UnFreeze timer

Protected variable

TSharedPtr < cla...

 

VirtualJoystick

The virtual touch interface

Functions

Name Description

Public function Virtual

void

 

AcknowledgePossession

(
    APawn * P
)

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.

Public function Virtual

void

 

BeginInactiveState()

Public function Virtual

void

 

BeginPlay()

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

 

CalcCamera

(
    float DeltaTime,
    FMinimalViewInfo & OutResult
)

Public function Virtual

void

 

Camera

(
    FName NewMode
)

Change Camera mode

Public function Virtual

bool

 

CanRestartPlayer()

True if this controller thinks it's able to restart. Called from GameModeBase::PlayerCanRestart

Public function Virtual

void

 

ChangeState

(
    FName NewState
)

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 Virtual

void

 

CleanupPlayerState()

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

 

ClientPlayForceFeedback

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

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

 

ClientReturnToMainMenu

(
    const FString & 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 < class AHUD > NewHUDCla...
)

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

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

 

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 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

True if pausing is allowed

Public function Virtual

void

 

DelayedPrepareMapChange()

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

Public function

bool

 

DeprojectMousePositionToWorld

(
    FVector & WorldLocation,
    FVector & WorldDirection
)

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

Public function

bool

 

DeprojectScreenPositionToWorld

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

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

Public function Virtual

void

 

Destroyed()

Public function Virtual

bool

 

DestroyNetworkActorHandled()

Protected function Virtual

void

 

DestroySpectatorPawn()

Destroys the SpectatorPawn and sets it to NULL.

Public function Virtual

void

 

DisableInput

(
    APlayerController * PlayerContr...
)

Public function Virtual

void

 

DisplayDebug

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

Public function Virtual

void

 

EnableCheats()

Enables cheats within the game

Public function Virtual

void

 

EnableInput

(
    APlayerController * PlayerContr...
)

Public function Virtual

void

 

EndInactiveState()

Public function Virtual

void

 

EndPlay

(
    const EEndPlayReason::Type EndPlayR...
)

Protected function Virtual

void

 

EndPlayingState()

Leave playing state. */.

Protected function Virtual

void

 

EndSpectatingState()

Event when no longer spectating.

Public function Virtual

void

 

FailedToSpawnPawn()

Public function Virtual

void

 

FellOutOfWorld

(
    const UDamageType& dmgType
)

Public function Virtual

void

 

FlushPressedKeys()

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 Virtual

void

 

GameHasEnded

(
    AActor * EndGameFocus,
    bool bIsWinner
)

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

void

 

GetActorEyesViewPoint

(
    FVector & Location,
    FRotator & Rotation
)

Public function Virtual

void

 

GetAudioListenerPosition

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

Get audio listener position and orientation

Protected function Virtual

ACameraActor ...

 

GetAutoActivateCameraForPlayer()

Public function

UInterpTrack...

 

GetControllingDirector()

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

Public function Virtual

FVector

 

GetFocalLocation()

Returns the location the PlayerController is focused on.

Public function

bool

 

GetHitResultAtScreenPosition

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

Public function

bool

 

GetHitResultAtScreenPosition

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

Public function

bool

 

GetHitResultAtScreenPosition

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

Public function

bool

 

GetHitResultAtScreenPosition

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

Public function

bool

 

GetHitResultUnderCursor

(
    ECollisionChannel TraceChannel,
    bool bTraceComplex,
    FHitResult & HitResult
)

Public function

bool

 

GetHitResultUnderCursorByChannel

(
    ETraceTypeQuery TraceChannel,
    bool bTraceComplex,
    FHitResult & HitResult
)

Public function

bool

 

GetHitResultUnderCursorForObjects

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

Public function

bool

 

GetHitResultUnderFinger

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

Public function

bool

 

GetHitResultUnderFingerByChannel

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

Public function

bool

 

GetHitResultUnderFingerForObjects

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

Public function

AHUD *

 

GetHUD()

Gets the HUD currently being used by this player controller

Public function

float

 

GetInputAnalogKeyState

(
    FKey Key
)

Returns the analog value for the given key/button.

Public function

void

 

GetInputAnalogStickState

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

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

Public function

float

 

GetInputKeyTimeDown

(
    FKey Key
)

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

Public function

void

 

GetInputMotionState

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

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

Public function

void

 

GetInputMouseDelta

(
    float& DeltaX,
    float& DeltaY
)

Retrieves how far the mouse moved this frame.

Public function

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

FVector

 

GetInputVectorKeyState

(
    FKey Key
)

Returns the vector value for the given key/button.

Public function

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

EMouseCursor ...

 

GetMouseCursor()

Public function

bool

 

GetMousePosition

(
    float& LocationX,
    float& LocationY
)

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

Public function Virtual

UNetConnecti ...

 

GetNetConnection()

Public function Virtual

const AActor ...

 

GetNetOwner()

Public function Virtual

UPlayer *...

 

GetNetOwningPlayer()

Public function Virtual

float

 

GetNetPriority

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

Public function Virtual

APlayerState ...

 

GetNextViewablePlayer

(
    int32 dir
)

Get next active viewable player in PlayerArray.

Public function

APawn *

 

GetPawnOrSpectator()

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

Public function

FString

 

GetPlayerNetworkAddress()

Get the local players network address

the address

Public function Virtual

void

 

GetPlayerViewPoint

(
    FVector & out_Location,
    FRotator & out_Rotation
)

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

the adress

Public function

FVector

 

GetSpawnLocation()

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

Public function

ASpectatorPa ...

 

GetSpectatorPawn()

Spectating.

Public function

APlayerState ...

 

GetSplitscreenPlayerByIndex

(
    int32 PlayerIndex
)

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

Public function

int32

 

GetSplitscreenPlayerCount()

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

Public function

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 Virtual

AActor *

 

GetViewTarget()

Public function

bool

 

HasClientLoadedCurrentWorld()

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

Protected function Virtual

bool

 

HasNetOwner()

Overridden to return that player controllers are capable of RPCs

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
)

Public function

bool

 

InputEnabled()

Public function Virtual

bool

 

InputKey

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

Public function Virtual

bool

 

InputMotion

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

Public function Virtual

bool

 

InputTouch

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

Public function Virtual

bool

 

IsFrozen()

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

Public function

bool

 

IsInputKeyDown

(
    FKey Key
)

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

Protected function Virtual

bool

 

IsInViewportClient

(
    UGameViewportClient* ViewportC...
)

Public function Virtual

bool

 

IsLocalController()

Public function Virtual

bool

 

IsNetRelevantFor

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

Public function

bool

 

IsPaused()

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

bool

 

IsPrimaryPlayer()

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

Public function

bool

 

IsSplitscreenPlayer

(
    int32* OutSplitscreenPlayerInd...
)

Determines whether this player is playing split-screen.

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 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 Virtual

void

 

OnActorChannelOpen

(
    FInBunch & InBunch,
    UNetConnection * Connection
)

Public function Virtual

void

 

OnNetCleanup

(
    UNetConnection * Connection
)

Public function Virtual

void

 

OnSerializeNewActor

(
    FOutBunch & OutBunch
)

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

void

 

PlayDynamicForceFeedback

(
    float Intensity,
    float Duration,
    bool bAffectsLeftLarge,
    bool bAffectsLeftSmall,
    bool bAffectsRightLarge,
    bool bAffectsRightSmall,
    TEnumAsByte < EDynamicForceFeedbackA ...,
    FLatentActionInfo LatentInfo
)

Latent action that controls the playing of force feedback 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

bool

 

PopInputComponent

(
    UInputComponent* Input
)

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

Public function Virtual

void

 

Possess

(
    APawn * aPawn
)

Public function Virtual

void

 

PostInitializeComponents()

Public function Virtual

void

 

PostLoad()

Public function Virtual

void

 

PostProcessInput

(
    const float DeltaTime,
    const bool bGamePaused
)

Method called after processing input

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

bool

 

ProjectWorldLocationToScreen

(
    FVector WorldLocation,
    FVector2D & ScreenLocation,
    bool bPlayerViewportRelative
)

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

Public function

bool

 

ProjectWorldLocationToScreenWithDistance

(
    FVector WorldLocation,
    FVector & ScreenLocation,
    bool bPlayerViewportRelative
)

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

Public function

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 < class ASpectatorPawn >...
)

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

Public function Virtual

void

 

Reset()

Public function Virtual

void

 

ResetCameraMode()

Reset Camera Mode to default.

Public function Virtual

void

 

ResetIgnoreInputFlags()

Reset move and look input ignore flags to defaults

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 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

 

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

(
    FName PackageName,
    bool bIsVisible
)

Called when the client adds/removes a streamed level the server will only replicate references to Actors in visible levels so that it's impossible to send references to Actors the client has not initialized

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

 

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 bAffectsMovement,
    bool bAffectsTurning
)

Adjust input based on cinematic 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

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

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

 

SetInitialLocationAndRotation

(
    const FVector & NewLocation,
    const FRotator & NewRotation
)

Public function Virtual

void

 

SetInputMode

(
    const FInputModeDataBase & InData
)

Setup an input mode.

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
)

Trys 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

 

SetPawn

(
    APawn * InPawn
)

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. Will also call AttachToPawn() using the new spectator.

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.

Public function

bool

 

ShouldPerformFullTickWhenPaused()

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

Public function Virtual

bool

 

ShouldShowMouseCursor()

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.

Public function Virtual

void

 

TickActor

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

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

 

UnPossess()

Public function Virtual

void

 

UpdateCameraManager

(
    float DeltaSeconds
)

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

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 >& Hid...
)

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

bool

 

UseShortConnectTimeout()

Public function Virtual

void

 

ViewAPlayer

(
    int32 dir
)

View next active player in PlayerArray.

Public function

bool

 

WasInputKeyJustPressed

(
    FKey Key
)

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

Public function

bool

 

WasInputKeyJustReleased

(
    FKey Key
)

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

See Also

References

Module

Engine

Header

Runtime/Engine/Classes/GameFramework/PlayerController.h