Navigation
Unreal Engine C++ API Reference > Runtime > Engine > GameFramework
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- AActor
- APawn
- ACharacter
- ADefaultPawn
- AAbilitySystemTestPawn
- ASpectatorPawn
- AMoverExamplesCharacter
- AXRCreativeAvatar
References
Module | Engine |
Header | /Engine/Source/Runtime/Engine/Classes/GameFramework/Pawn.h |
Include | #include "GameFramework/Pawn.h" |
Syntax
UCLASS (Config=Game, BlueprintType, Blueprintable, HideCategories=(Navigation),
Meta=(ShortTooltip="A Pawn is an actor that can be 'possessed' and receive input from a controller."),
MinimalAPI)
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
Type | Name | Description | |
---|---|---|---|
![]() ![]() ![]() ![]() |
TSubclassOf< AController > | AIControllerClass | Default class to use when pawn is controlled by AI. |
![]() |
float | AllowedYawError | Max difference between pawn's Rotation.Yaw and GetDesiredRotation().Yaw for pawn to be considered as having reached its desired rotation |
![]() ![]() ![]() |
EAutoPossessAI | AutoPossessAI | Determines when the Pawn creates and is possessed by an AI Controller (on level start, when spawned, etc). |
![]() ![]() ![]() |
TEnumAsByte< EAutoReceiveInput::Type > | AutoPossessPlayer | Determines which PlayerController, if any, should automatically possess the pawn when the level starts or when the pawn is spawned. |
![]() ![]() ![]() ![]() |
float | BaseEyeHeight | Base eye height above collision center. |
![]() ![]() ![]() ![]() |
uint32: 1 | bCanAffectNavigationGeneration | If set to false (default) given pawn instance will never affect navigation generation (but components could). |
![]() ![]() ![]() |
uint32: 1 | bIsLocalViewTarget | |
![]() |
float | BlendedReplayViewPitch | Playback of replays writes blended pitch to this, rather than the RemoteViewPitch. |
![]() ![]() ![]() ![]() |
uint32: 1 | bUseControllerRotationPitch | If true, this Pawn's pitch will be updated to match the Controller's ControlRotation pitch, if controlled by a PlayerController. |
![]() ![]() ![]() ![]() |
uint32: 1 | bUseControllerRotationRoll | If true, this Pawn's roll will be updated to match the Controller's ControlRotation roll, if controlled by a PlayerController. |
![]() ![]() ![]() ![]() |
uint32: 1 | bUseControllerRotationYaw | If true, this Pawn's yaw will be updated to match the Controller's ControlRotation yaw, if controlled by a PlayerController. |
![]() ![]() ![]() |
FVector | ControlInputVector | Accumulated control input vector, stored in world space. |
![]() ![]() ![]() |
TObjectPtr< AController > | Controller | Controller currently possessing this Actor |
![]() ![]() ![]() |
FVector | LastControlInputVector | The last control input vector that was processed by ConsumeMovementInputVector(). |
![]() ![]() ![]() ![]() ![]() |
TObjectPtr< AController > | LastHitBy | Controller of the last Actor that caused us damage. |
![]() ![]() ![]() |
TSubclassOf< UInputComponent > | OverrideInputComponentClass | If set, then this InputComponent class will be used instead of the Input Settings' DefaultInputComponentClass |
![]() ![]() ![]() |
TObjectPtr< AController > | PreviousController | Previous controller that was controlling this pawn since the last controller change notification |
![]() ![]() ![]() ![]() |
FPawnControllerChangedSignature | ReceiveControllerChangedDelegate | Event called after a pawn's controller has changed, on the server and owning client. |
![]() ![]() ![]() ![]() |
FPawnRestartedSignature | ReceiveRestartedDelegate | Event called after a pawn has been restarted, usually by a possession change. |
![]() ![]() ![]() |
uint8 | RemoteViewPitch | Replicated so we can see where remote clients are looking. |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
APawn
(
const FObjectInitializer& ObjectInitializer |
Default UObject constructor. |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() ![]() ![]() |
void | AddControllerPitchInput
(
float Val |
Add input (affecting Pitch) to the Controller's ControlRotation, if it is a local PlayerController. |
![]() ![]() ![]() ![]() |
void | AddControllerRollInput
(
float Val |
Add input (affecting Roll) to the Controller's ControlRotation, if it is a local PlayerController. |
![]() ![]() ![]() ![]() |
void | AddControllerYawInput
(
float Val |
Add input (affecting Yaw) to the Controller's ControlRotation, if it is a local PlayerController. |
![]() ![]() ![]() ![]() |
void | AddMovementInput
(
FVector WorldDirection, |
Add movement input along the given world direction vector (usually normalized) scaled by 'ScaleValue'. |
![]() ![]() ![]() ![]() |
FVector | Returns the pending input vector and resets it to zero. | |
![]() ![]() |
UInputComponent * | Creates an InputComponent that can be used for custom input bindings. | |
![]() ![]() |
void | Destroys the player input component and removes any references to it. | |
![]() ![]() ![]() ![]() |
void | Call this function to detach safely pawn from its controller, knowing that we will be destroyed soon. | |
![]() |
void | DispatchRestart
(
bool bCallClientRestart |
Wrapper function to call correct restart functions, enable bCallClientRestart if this is a locally owned player pawn or equivalent |
![]() ![]() |
void | DisplayDebug
(
UCanvas* Canvas, |
|
![]() ![]() |
void | FaceRotation
(
FRotator NewControlRotation, |
Updates Pawn's rotation to the given rotation, assumed to be the Controller's ControlRotation. |
![]() ![]() ![]() ![]() ![]() |
FRotator | Return the aim rotation for the Pawn. | |
![]() ![]() ![]() ![]() |
AController * | Returns controller for this actor. | |
![]() ![]() |
T * | Returns controller for this actor cast to the template type. May return NULL is the cast fails. | |
![]() ![]() ![]() ![]() |
FRotator | Get the rotation of the Controller, often the 'view' rotation of this Pawn. | |
![]() ![]() ![]() |
AController * | GetDamageInstigator
(
AController* InstigatedBy, |
Get the controller instigating the damage. |
![]() ![]() ![]() |
float | Returns The half-height of the default Pawn, scaled by the component scale. | |
![]() ![]() ![]() |
FVector | Returns vector direction of gravity | |
![]() ![]() ![]() |
FQuat | Returns a quaternion transforming from world space into gravity relative space | |
![]() ![]() ![]() ![]() |
FVector | Return the last input vector in world space that was processed by ConsumeMovementInputVector(), which is usually done by the Pawn or PawnMovementComponent. | |
![]() ![]() ![]() ![]() |
APlayerController * | Returns local Player Controller viewing this pawn, whether it is controlling or spectating | |
![]() ![]() ![]() |
UPrimitiveComponent * | Return PrimitiveComponent we are based on (standing on, attached to, and moving on). | |
![]() ![]() ![]() ![]() |
AActor * | GetMovementBaseActor
(
const APawn* Pawn |
Gets the owning actor of the Movement Base Component on which the pawn is standing. |
![]() ![]() ![]() ![]() ![]() |
UPawnMovementComponent * | Return our PawnMovementComponent, if we have one. | |
![]() ![]() ![]() ![]() |
TSubclassOf< UInputComponent > | ||
![]() ![]() ![]() |
UPawnNoiseEmitterComponent * | Return our PawnNoiseEmitterComponent, if any. | |
![]() ![]() ![]() |
APhysicsVolume * | Return Physics Volume for this Pawn | |
![]() ![]() ![]() |
FVector | Returns Pawn's eye location | |
![]() ![]() ![]() ![]() |
FVector | Return the pending input vector in world space. | |
![]() ![]() ![]() ![]() |
FPlatformUserId | Returns the Platform User ID of the PlayerController that is controlling this character. | |
![]() ![]() |
APlayerState * | If Pawn is possessed by a player, returns its Player State. | |
![]() ![]() |
T * | Templated convenience version of GetPlayerState. | |
![]() ![]() |
T * | Templated convenience version of GetPlayerState which checks the type is as presumed. | |
![]() ![]() ![]() |
FRotator | Get the view rotation of the Pawn (direction they are looking, normally Controller->ControlRotation). | |
![]() ![]() ![]() |
bool | InFreeCam () |
Returns true if player is viewing this Pawn in FreeCam |
![]() ![]() |
bool | InputEnabled () |
Whether this Pawn's input handling is enabled. |
![]() |
void | Internal_AddMovementInput
(
FVector WorldAccel, |
Internal function meant for use only within Pawn or by a PawnMovementComponent. |
![]() |
FVector | Internal function meant for use only within Pawn or by a PawnMovementComponent. | |
![]() ![]() |
FVector | Internal function meant for use only within Pawn or by a PawnMovementComponent. | |
![]() ![]() |
FVector | Internal function meant for use only within Pawn or by a PawnMovementComponent. | |
![]() ![]() ![]() ![]() ![]() |
bool | Returns true if controlled by a bot. | |
![]() ![]() ![]() ![]() |
bool | IsControlled () |
See if this actor is currently being controlled |
![]() ![]() ![]() ![]() ![]() |
bool | Returns true if controlled by a local (not network) Controller. | |
![]() ![]() ![]() ![]() |
bool | Is this pawn the ViewTarget of a local PlayerController? Helpful for determining whether the pawn is visible/critical for any VFX. | |
![]() ![]() |
bool | ||
![]() ![]() ![]() ![]() ![]() |
bool | Helper to see if move input is ignored. | |
![]() ![]() ![]() ![]() ![]() |
bool | Check if this actor is currently being controlled at all (the actor has a valid Controller, which will be false for remote clients) | |
![]() ![]() ![]() ![]() ![]() |
bool | Returns true if controlled by a human player (possessed by a PlayerController). | |
![]() |
void | MoveIgnoreActorAdd
(
AActor* ActorToIgnore |
Add an Actor to ignore by Pawn's movement collision |
![]() |
void | MoveIgnoreActorRemove
(
AActor* ActorToIgnore |
Remove an Actor to ignore by Pawn's movement collision |
![]() ![]() |
void | Call to notify about a change in controller, on both the server and owning client. | |
![]() ![]() |
void | Notifies other systems that a pawn has been restarted. | |
![]() ![]() |
void | OnPlayerStateChanged
(
APlayerState* NewPlayerState, |
Called on both the clientand server when ever SetPlayerState is called on this pawn. |
![]() ![]() ![]() |
void | Called when Controller is replicated | |
![]() ![]() ![]() |
void | PlayerState Replication Notification Callback | |
![]() ![]() |
void | Called on the owning client of a player-controlled Pawn when it is restarted, this calls Restart() | |
![]() ![]() ![]() |
void | PawnMakeNoise
(
float Loudness, |
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. |
![]() ![]() |
void | PawnStartFire
(
uint8 FireModeNum |
Handle StartFire() passed from PlayerController |
![]() ![]() |
void | PossessedBy
(
AController* NewController |
Called when this Pawn is possessed. Only called on the server (or in standalone). |
![]() ![]() |
bool | Return true if yaw is within AllowedYawError of desired yaw | |
![]() ![]() |
void | Set BaseEyeHeight based on current state. | |
![]() ![]() ![]() |
void | ReceiveControllerChanged
(
AController* OldController, |
Event called after a pawn's controller has changed, on the server and owning client. |
![]() ![]() ![]() |
void | ReceivePossessed
(
AController* NewController |
Event called when the Pawn is possessed by a Controller. |
![]() ![]() ![]() |
void | Event called after a pawn has been restarted, usually by a possession change. | |
![]() ![]() ![]() |
void | ReceiveUnpossessed
(
AController* OldController |
Event called when the Pawn is no longer possessed by a Controller. |
![]() ![]() |
void | Restart () |
Called when the Pawn is being restarted (usually by being possessed by a Controller). |
![]() ![]() ![]() |
void | SetCanAffectNavigationGeneration
(
bool bNewValue, |
Use SetCanAffectNavigationGeneration to change this value at runtime. |
![]() ![]() |
void | Make sure pawn properties are back to default. | |
![]() |
void | SetPlayerState
(
APlayerState* NewPlayerState |
Set the Pawn's Player State. |
![]() |
void | SetRemoteViewPitch
(
float NewRemoteViewPitch |
Set Pawn ViewPitch, so we can see where remote clients are looking. Maps 360.0 degrees into a byte |
![]() ![]() |
void | SetupPlayerInputComponent
(
UInputComponent* PlayerInputComponent |
Allows a Pawn to set up custom input bindings. |
![]() ![]() ![]() |
bool | ShouldTakeDamage
(
float Damage, |
Return 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. |
![]() ![]() ![]() ![]() |
void | Spawn default controller for this Pawn, and get possessed by it. | |
![]() ![]() |
void | TurnOff () |
Freeze pawn - stop sounds, animations, physics, weapon firing |
![]() ![]() |
void | UnPossessed () |
Called when our Controller no longer possesses us. Only called on the server (or in standalone). |
![]() |
void | Updates MovementComponent's parameters used by navigation system | |
![]() ![]() |
void | Update all components relevant for navigation generators to match bCanAffectNavigationGeneration flag |
Overridden from AActor
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | BecomeViewTarget
(
APlayerController* PC |
Called when this actor becomes the given PlayerController's ViewTarget. |
![]() ![]() |
void | BeginPlay () |
Overridable native event for when play begins for this actor. |
![]() ![]() ![]() |
bool | CanBeBaseForCharacter
(
APawn* APawn |
Overridden to defer to the RootComponent's CanCharacterStepUpOn setting if it is explicitly Yes or No. |
![]() ![]() |
void | Destroyed () |
Called when this actor is explicitly being destroyed during gameplay or in the editor, not called during level streaming or gameplay ending |
![]() ![]() |
void | DisableInput
(
APlayerController* PlayerController |
Removes this actor from the stack of input being handled by a PlayerController. |
![]() ![]() |
void | EditorApplyRotation
(
const FRotator& DeltaRotation, |
Called by ApplyDeltaToActor to perform an actor class-specific operation based on widget manipulation. |
![]() ![]() |
void | EnableInput
(
APlayerController* PlayerController |
Pushes this actor on to the stack of input being handled by a PlayerController. |
![]() ![]() |
void | EndPlay
(
const EEndPlayReason::Type EndPlayReason |
Overridable function called whenever this actor is being removed from a level |
![]() ![]() |
void | EndViewTarget
(
APlayerController* PC |
Called when this actor is no longer the given PlayerController's ViewTarget. |
![]() ![]() ![]() |
void | GetActorEyesViewPoint
(
FVector& OutLocation, |
Returns the point of view of the actor. |
![]() ![]() ![]() |
FString | Returns the human readable string representation of an object. | |
![]() ![]() ![]() |
UNetConnection * | Get the owning connection used for communicating between client/server | |
![]() ![]() ![]() |
const AActor * | GetNetOwner () |
Return the actor responsible for replication, if any. Typically the player controller |
![]() ![]() |
UPlayer * | Return the owning UPlayer (if any) of this actor. | |
![]() ![]() ![]() |
APhysicsVolume * | Return Physics Volume for this Pawn | |
![]() ![]() ![]() |
FVector | GetVelocity () |
Returns velocity (in cm/s (Unreal Units/second) of the rootcomponent if it is either using physics or has an associated MovementComponent |
![]() ![]() ![]() |
bool | IsBasedOnActor
(
const AActor* Other |
Iterates up the movement base chain to see whether or not this Actor is based on the given Actor, defaults to checking attachment |
![]() ![]() ![]() |
bool | IsNetRelevantFor
(
const AActor* RealViewer, |
Checks to see if this actor is relevant for a specific network connection |
![]() ![]() |
void | Called when the Actor is outside the hard limit on world bounds | |
![]() ![]() |
void | Allow actors to initialize themselves on the C++ side after all of their components have been initialized, only called during gameplay | |
![]() ![]() |
void | Update location and rotation from ReplicatedMovement. Not called for simulated physics! | |
![]() ![]() |
void | PostNetReceiveVelocity
(
const FVector& NewVelocity |
Update velocity - typically from ReplicatedMovement, not called for simulated physics! |
![]() ![]() |
void | Called after all the components in the Components array are registered, called both in editor and during gameplay. | |
![]() ![]() |
void | Called right before components are initialized, only called during gameplay | |
![]() ![]() |
void | PreReplication
(
IRepChangedPropertyTracker& ChangedPropertyTracker |
Called on the actor right before replication occurs. |
![]() ![]() |
void | Reset () |
Reset actor to initial state - used when restarting level without reloading. |
![]() ![]() ![]() |
bool | If true, actor is ticked even if TickType==LEVELTICK_ViewportsOnly | |
![]() ![]() |
float | TakeDamage
(
float DamageAmount, |
Apply damage to this actor. |
![]() ![]() |
void | TeleportSucceeded
(
bool bIsATest |
Called from TeleportTo() when teleport succeeds |
Overridden from UObject
Type | Name | Description | |
---|---|---|---|
![]() ![]() ![]() |
void | GetLifetimeReplicatedProps
(
TArray< FLifetimeProperty >& OutLifetimeProps |
Returns the properties used for network replication, this needs to be overridden by all actor classes with native replicated properties |
![]() ![]() |
void | PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
Called when a property on this object has been modified externally |
![]() ![]() |
void | PostLoad () |
Do any object-specific cleanup required immediately after loading an object. |
Overridden from INavAgentInterface
Type | Name | Description | |
---|---|---|---|
![]() ![]() ![]() ![]() ![]() |
void | GetMoveGoalReachTest
(
const AActor* MovingActor, |
Get cylinder for testing if actor has been reached |
![]() ![]() ![]() ![]() ![]() |
FVector | Basically retrieved pawn's location on navmesh | |
![]() ![]() ![]() |
const FNavAgentProperties & | Retrieves FNavAgentProperties expressing navigation props and caps of represented agent @NOTE the function will be renamed to GetNavAgentProperties in 4.8. |
Constants
Name | Description |
---|---|
OnPawnBeginPlay | A delegate that broadcasts a notification whenever BeginPlay() is called |
See Also
https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Pawn/