APawn

Inheritance Hierarchy

Syntax

class APawn :
    public AActor ,
    public INavAgentInterface

Remarks

Pawn is the base class of all actors that can be possessed by players or AI. They are the physical representations of players and creatures in a level.

Variables

Name Description

Public variable

TSubclassOf < AC ...

 

AIControllerClass

Default class to use when pawn is controlled by AI.

Public variable

float

 

AllowedYawError

Max difference between pawn's Rotation.Yaw and GetDesiredRotation().Yaw for pawn to be considered as having reached its desired rotation

Public variable

EAutoPossessAI

 

AutoPossessAI

Determines when the Pawn creates and is possessed by an AI Controller (on level start, when spawned, etc).

Public variable

TEnumAsByte < EA ...

 

AutoPossessPlayer

Determines which PlayerController, if any, should automatically possess the pawn when the level starts or when the pawn is spawned.

Public variable

float

 

BaseEyeHeight

Base eye height above collision center.

Public variable

uint32 : 1

 

bCanAffectNavigationGeneration

If set to false (default) given pawn instance will never affect navigation generation.

Public variable

uint32 : 1

 

bProcessingOutsideWorldBounds

Used to prevent re-entry of OutsideWorldBounds event.

Public variable

uint32 : 1

 

bUseControllerRotationPitch

If true, this Pawn's pitch will be updated to match the Controller's ControlRotation pitch, if controlled by a PlayerController.

Public variable

uint32 : 1

 

bUseControllerRotationRoll

If true, this Pawn's roll will be updated to match the Controller's ControlRotation roll, if controlled by a PlayerController.

Public variable

uint32 : 1

 

bUseControllerRotationYaw

If true, this Pawn's yaw will be updated to match the Controller's ControlRotation yaw, if controlled by a PlayerController.

Protected variable

FVector

 

ControlInputVector

Accumulated control input vector, stored in world space.

Public variable

AController ...

 

Controller

Controller currently possessing this Actor

Protected variable

FVector

 

LastControlInputVector

The last control input vector that was processed by ConsumeMovementInputVector() .

Public variable

AController ...

 

LastHitBy

Controller of the last Actor that caused us damage.

Public variable

APlayerState &#...

 

PlayerState

If Pawn is possessed by a player, points to his playerstate.

Public variable

uint8

 

RemoteViewPitch

Replicated so we can see where remote clients are looking.

Constructors

Name Description

Public function

APawn

(
    const FObjectInitializer & ObjectIn...
)

Default UObject constructor.

Functions

Name Description

Public function Virtual

void

 

AddControllerPitchInput

(
    float Val
)

Add input (affecting Pitch) to the Controller's ControlRotation, if it is a local PlayerController.

Public function Virtual

void

 

AddControllerRollInput

(
    float Val
)

Add input (affecting Roll) to the Controller's ControlRotation, if it is a local PlayerController.

Public function Virtual

void

 

AddControllerYawInput

(
    float Val
)

Add input (affecting Yaw) to the Controller's ControlRotation, if it is a local PlayerController.

Public function Virtual

void

 

AddMovementInput

(
    FVector WorldDirection,
    float ScaleValue,
    bool bForce
)

Add movement input along the given world direction vector (usually normalized) scaled by 'ScaleValue'.

Public function Virtual

void

 

ClientSetRotation

(
    FRotator NewRotation
)

DEPRECATED FUNCTIONS.

Public function Virtual

FVector

 

ConsumeMovementInputVector()

Returns the pending input vector and resets it to zero.

Protected function Virtual

UInputCompon ...

 

CreatePlayerInputComponent()

Creates an InputComponent that can be used for custom input bindings.

Protected function Virtual

void

 

DestroyPlayerInputComponent()

Destroys the player input component and removes any references to it.

Public function Virtual

void

 

DetachFromControllerPendingDestroy()

Call this function to detach safely pawn from its controller, knowing that we will be destroyed soon.

Public function Virtual

void

 

DisplayDebug

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

Public function Virtual

void

 

FaceRotation

(
    FRotator NewControlRotation,
    float DeltaTime
)

Updates Pawn's rotation to the given rotation, assumed to be the Controller's ControlRotation.

Public function Virtual

FRotator

 

GetBaseAimRotation()

Return the aim rotation for the Pawn.

Public function

AController ...

 

GetController()

Pawn inlines.

Public function

FRotator

 

GetControlRotation()

Get the rotation of the Controller, often the 'view' rotation of this Pawn.

Protected function Virtual

AController ...

 

GetDamageInstigator

(
    AController * InstigatedBy,
    const UDamageType & DamageType
)

Get the controller instigating the damage.

Public function Virtual

float

 

GetDefaultHalfHeight()

The half-height of the default Pawn, scaled by the component scale.

Public function

FVector

 

GetGravityDirection()

Vector direction of gravity

Public function

FVector

 

GetLastMovementInputVector()

Return the last input vector in world space that was processed by ConsumeMovementInputVector() , which is usually done by the Pawn or PawnMovementComponent.

Public function Virtual

UPrimitiveCo ...

 

GetMovementBase()

Return PrimitiveComponent we are based on (standing on, attached to, and moving on).

Public function Static

AActor *

 

GetMovementBaseActor

(
    const APawn * Pawn
)

Gets the owning actor of the Movement Base Component on which the pawn is standing.

Public function Virtual

UPawnMovemen ...

 

GetMovementComponent()

Return our PawnMovementComponent, if we have one.

Public function

FVector

 

GetMovementInputVector()

TODO: deprecated, remove.

Public function Virtual

UPawnNoiseEm ...

 

GetPawnNoiseEmitterComponent()

Return our PawnNoiseEmitterComponent, if any.

Public function Virtual

APhysicsVolu ...

 

GetPawnPhysicsVolume()

Return Physics Volume for this Pawn

Public function Virtual

FVector

 

GetPawnViewLocation()

Pawn's eye location

Public function

FVector

 

GetPendingMovementInputVector()

Return the pending input vector in world space.

Public function Virtual

FRotator

 

GetViewRotation()

Get the view rotation of the Pawn (direction they are looking, normally Controller->ControlRotation).

Public function Virtual

bool

 

InFreeCam()

Return true if player is viewing this Pawn in FreeCam

Public function

bool

 

InputEnabled()

Public function

void

 

Internal_AddMovementInput

(
    FVector WorldAccel,
    bool bForce
)

Internal function meant for use only within Pawn or by a PawnMovementComponent.

Public function

FVector

 

Internal_ConsumeMovementInputVector()

Internal function meant for use only within Pawn or by a PawnMovementComponent.

Public function

FVector

 

Internal_GetLastMovementInputVector()

Internal function meant for use only within Pawn or by a PawnMovementComponent.

Public function

FVector

 

Internal_GetMovementInputVector()

Internal function meant for use only within Pawn or by a PawnMovementComponent.

Public function

FVector

 

Internal_GetPendingMovementInputVector()

Internal function meant for use only within Pawn or by a PawnMovementComponent.

Public function

bool

 

IsControlled()

See if this actor is currently being controlled

Public function Virtual

bool

 

IsLocallyControlled()

True if controlled by a local (not network) Controller.

Public function Virtual

bool

 

IsMoveInputIgnored()

Helper to see if move input is ignored.

Public function Virtual

bool

 

IsPlayerControlled()

True if controlled by a human player (possessed by a PlayerController).

Public function

FVector

 

K2_GetMovementInputVector()

TODO: deprecated, remove.

Public function

void

 

LaunchPawn

(
    FVector LaunchVelocity,
    bool bXYOverride,
    bool bZOverride
)

: Deprecated, remove me.

Public function

void

 

MoveIgnoreActorAdd

(
    AActor * ActorToIgnore
)

Add an Actor to ignore by Pawn's movement collision

Public function

void

 

MoveIgnoreActorRemove

(
    AActor * ActorToIgnore
)

Remove an Actor to ignore by Pawn's movement collision

Public function Virtual

void

 

OnRep_Controller()

Called when Controller is replicated

Public function Virtual

void

 

OnRep_PlayerState()

PlayerState Replication Notification Callback

Public function Virtual

void

 

PawnClientRestart()

Tell client that the Pawn is begin restarted.

Public function

void

 

PawnMakeNoise

(
    float Loudness,
    FVector NoiseLocation,
    bool bUseNoiseMakerLocation,
    AActor * NoiseMaker
)

Inform AIControllers that you've made a noise they might hear (they are sent a HearNoise message if they have bHearNoises==true) The instigator of this sound is the pawn which is used to call MakeNoise.

Public function Virtual

void

 

PawnStartFire

(
    uint8 FireModeNum
)

Handle StartFire() passed from PlayerController

Public function Virtual

void

 

PossessedBy

(
    AController * NewController
)

Called when this Pawn is possessed. Only called on the server (or in standalone).

Public function Virtual

bool

 

ReachedDesiredRotation()

Public function Virtual

void

 

RecalculateBaseEyeHeight()

Set BaseEyeHeight based on current state.

Public function

void

 

ReceivePossessed

(
    AController * NewController
)

Event called when the Pawn is possessed by a Controller (normally only occurs on the server/standalone).

Public function

void

 

ReceiveUnpossessed

(
    AController * OldController
)

Event called when the Pawn is no longer possessed by a Controller.

Public function Virtual

void

 

Restart()

Called when the Pawn is being restarted (usually by being possessed by a Controller).

Public function

void

 

SetCanAffectNavigationGeneration

(
    bool bNewValue,
    bool bForceUpdate
)

Use SetCanAffectNavigationGeneration to change this value at runtime.

Public function Virtual

void

 

SetPlayerDefaults()

Make sure pawn properties are back to default.

Public function

void

 

SetRemoteViewPitch

(
    float NewRemoteViewPitch
)

Set Pawn ViewPitch, so we can see where remote clients are looking. Maps 360.0 degrees into a byte

Protected function Virtual

void

 

SetupPlayerInputComponent

(
    UInputComponent * PlayerInputCo...
)

Allows a Pawn to set up custom input bindings.

Public function Virtual

bool

 

ShouldTakeDamage

(
    float Damage,
    FDamageEvent const& DamageEvent,
    AController * EventInstigator,
    AActor * DamageCauser
)

True if we are in a state to take damage (checked at the start of TakeDamage. Subclasses may check this as well if they override TakeDamage and don't want to potentially trigger TakeDamage actions by checking if it returns zero in the super class.

Public function Virtual

void

 

SpawnDefaultController()

Spawn default controller for this Pawn, and get possessed by it.

Public function Virtual

void

 

TurnOff()

Freeze pawn - stop sounds, animations, physics, weapon firing

Public function Virtual

void

 

UnPossessed()

Called when our Controller no longer possesses us.

Public function

void

 

UpdateNavAgent()

Updates MovementComponent's parameters used by navigation system

Public function Virtual

void

 

UpdateNavigationRelevance()

Update all components relevant for navigation generators to match bCanAffectNavigationGeneration flag

Overridden from AActor

Name Description

Public function Virtual

void

 

BecomeViewTarget

(
    APlayerController * PC
)

Called when this actor becomes the given PlayerController's ViewTarget.

Public function Virtual

bool

 

CanBeBaseForCharacter

(
    APawn * APawn
)

Overridden to defer to the RootComponent's CanCharacterStepUpOn setting if it is explicitly Yes or No.

Public function Virtual

void

 

Destroyed()

Called once this actor has been deleted

Public function Virtual

void

 

DisableInput

(
    APlayerController * PlayerContr...
)

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

Public function Virtual

void

 

EditorApplyRotation

(
    const FRotator & DeltaRotation,
    bool bAltDown,
    bool bShiftDown,
    bool bCtrlDown
)

Called by ApplyDeltaToActor to perform an actor class-specific operation based on widget manipulation.

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

 

GetActorEyesViewPoint

(
    FVector & OutLocation,
    FRotator & OutRotation
)

Returns the point of view of the actor.

Public function Virtual

FString

 

GetHumanReadableName()

Returns the human readable string representation of an object.

Public function Virtual

UNetConnecti ...

 

GetNetConnection()

Get the owning connection used for communicating between client/server

Public function Virtual

const AActor ...

 

GetNetOwner()

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

Public function Virtual

UPlayer *...

 

GetNetOwningPlayer()

The owning UPlayer (if any) of this actor.

Public function Virtual

FVector

 

GetVelocity()

Returns velocity (in cm/s (Unreal Units/second) of the rootcomponent if it is either using physics or has an associated MovementComponent

Public function Virtual

bool

 

IsBasedOnActor

(
    const AActor * Other
)

Iterates up the Base chain to see whether or not this Actor is based on the given Actor

Public function Virtual

bool

 

IsNetRelevantFor

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

Actor relevancy determination

Public function Virtual

void

 

OutsideWorldBounds()

Called when the Actor is outside the hard limit on world bounds

Public function Virtual

void

 

PostInitializeComponents()

Allow actors to initialize themselves on the C++ side.

Public function Virtual

void

 

PostNetReceiveLocationAndRotation()

Update location and rotation from ReplicatedMovement. Not called for simulated physics!

Public function Virtual

void

 

PostNetReceiveVelocity

(
    const FVector & NewVelocity
)

REPLICATION.

Public function Virtual

void

 

PostRegisterAllComponents()

Called after all the components in the Components array are registered

Public function Virtual

void

 

PreInitializeComponents()

Called immediately before gameplay begins.

Public function Virtual

void

 

PreReplication

(
    IRepChangedPropertyTracker & Change...
)

Called on the actor right before replication occurs

Public function Virtual

void

 

Reset()

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

Public function Virtual

bool

 

ShouldTickIfViewportsOnly()

If true, actor is ticked even if TickType==LEVELTICK_ViewportsOnly

Public function Virtual

float

 

TakeDamage

(
    float DamageAmount,
    FDamageEvent const& DamageEvent,
    AController * EventInstigator,
    AActor * DamageCauser
)

Apply damage to this actor.

The amount of damage actually applied.

Public function Virtual

void

 

TeleportSucceeded

(
    bool bIsATest
)

Called from TeleportTo() when teleport succeeds

Overridden from UObject

Name Description

Public function Virtual

void

 

GetLifetimeReplicatedProps

(
    TArray < FLifetimeProperty >& OutLi...
)

Returns properties that are replicated for the lifetime of the actor channel

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent & PropertyCha...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object, and immediately after any undo/redo.

Overridden from INavAgentInterface

Name Description

Public function Virtual

void

 

GetMoveGoalReachTest

(
    const AActor * MovingActor,
    const FVector & MoveOffset,
    FVector & GoalOffset,
    float& GoalRadius,
    float& GoalHalfHeight
)

Get cylinder for testing if actor has been reached

Public function Virtual

FVector

 

GetNavAgentLocation()

Basically retrieved pawn's location on navmesh

Public function Virtual

const FNavAg ...

 

GetNavAgentPropertiesRef()

Retrieves FNavAgentProperties expressing navigation props and caps of represented agent the function will be renamed to GetNavAgentProperties in 4.8.

See Also

References

Module

Engine

Header

Runtime/Engine/Classes/GameFramework/Pawn.h