Header <GameFramework/Pawn.h>
#include "GameFramework/Pawn.h"Includes 8
<CoreMinimal.h> |
<UObject/ObjectMacros.h> |
<UObject/UObjectGlobals.h> |
<Templates/SubclassOf.h> |
<UObject/CoreNet.h> |
<Engine/EngineTypes.h> |
<GameFramework/Actor.h> |
<AI/Navigation/NavAgentInterface.h> |
Contents
APawn | 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. (uclass class : AActor) |
Functions | 1 free functions (namespace scope) |
class APawn
class APawn : public AActor, public INavAgentInterfaceUCLASSconfig=GameBlueprintTypeBlueprintablehideCategories=(Navigation)MinimalAPIPawn 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.
Constructors 1
| APawn | APawn(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());Default UObject constructor. |
Member functions 108
| GetLifetimeReplicatedProps | virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override; |
| PreReplication | virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override; |
| GetMovementComponent | virtual UPawnMovementComponent* GetMovementComponent() const;UFUNCTIONBlueprintCallableCategory=PawnReturn our PawnMovementComponent, if we have one. By default, returns the first PawnMovementComponent found. Native classes that create their own movement component should override this method for more efficiency. |
| GetMovementBase | virtual UPrimitiveComponent* GetMovementBase() const;Return PrimitiveComponent we are based on (standing on, attached to, and moving on). |
| GetPawnNoiseEmitterComponent | virtual UPawnNoiseEmitterComponent* GetPawnNoiseEmitterComponent() const;Return our PawnNoiseEmitterComponent, if any. Default implementation returns the first PawnNoiseEmitterComponent found in the components array. If one isn't found, then it tries to find one on the Pawn's current… |
| PawnMakeNoise | void PawnMakeNoise(float Loudness, FVector NoiseLocation, bool bUseNoiseMakerLocation = true, AActor* NoiseMaker = nullptr);UFUNCTIONBlueprintCallableBlueprintAuthorityOnlyCategory=AIInform 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. |
| GetLocalViewingPlayerController | APlayerController* GetLocalViewingPlayerController() const;UFUNCTIONBlueprintCallableCategory=PawnReturns local Player Controller viewing this pawn, whether it is controlling or spectating |
| IsLocallyViewed | bool IsLocallyViewed() const;UFUNCTIONBlueprintCallableCategory=PawnIs this pawn the ViewTarget of a local PlayerController? Helpful for determining whether the pawn is visible/critical for any VFX. NOTE: Technically there may be some cases where locally controlled pawns return false… |
| IsLocalPlayerControllerViewingAPawn | bool IsLocalPlayerControllerViewingAPawn() const; |
| SetPlayerState | void SetPlayerState(APlayerState* NewPlayerState);Set the Pawn's Player State. Keeps bi-directional reference of Pawn to Player State and back in sync. |
| GetPlayerState | APlayerState* GetPlayerState() const;template<class T> T* GetPlayerState() const;If Pawn is possessed by a player, returns its Player State. Needed for network play as controllers are not replicated to clients. |
| GetPlayerStateChecked | template<class T> T* GetPlayerStateChecked() const;Templated convenience version of GetPlayerState which checks the type is as presumed. |
| OnPlayerStateChanged | virtual void OnPlayerStateChanged(APlayerState* NewPlayerState, APlayerState* OldPlayerState);protectedCalled on both the clientand server when ever SetPlayerState is called on this pawn. |
| TurnOff | virtual void TurnOff();Freeze pawn - stop sounds, animations, physics, weapon firing |
| PawnStartFire | virtual void PawnStartFire(uint8 FireModeNum = 0);Handle StartFire() passed from PlayerController |
| GetRemoteViewPitch | uint16 GetRemoteViewPitch() const;Replicated pitch value so we can see where remote clients are looking. |
| SetRemoteViewPitch | void SetRemoteViewPitch(double NewRemoteViewPitch);Set Pawn ViewPitch, so we can see where remote clients are looking. Maps 360.0 degrees into 16 bits |
| GetPhysicsVolume | virtual APhysicsVolume* GetPhysicsVolume() const override;Return Physics Volume for this Pawn |
| ReachedDesiredRotation | virtual bool ReachedDesiredRotation();Return true if yaw is within AllowedYawError of desired yaw |
| GetDefaultHalfHeight | virtual float GetDefaultHalfHeight() const;Returns The half-height of the default Pawn, scaled by the component scale. By default returns the half-height of the RootComponent, regardless of whether it is registered or collidable. |
| IsPawnControlled | virtual bool IsPawnControlled() const;UFUNCTIONBlueprintCallableCategory=PawnCheck if this actor is currently being controlled at all (the actor has a valid Controller, which will be false for remote clients) |
| GetController | AController* GetController() const;UFUNCTIONBlueprintCallableCategory=Pawntemplate <class T> T* GetController() const;Returns controller for this actor. |
| SetController | void SetController(AController* InController);Sets controller for this actor |
| GetControlRotation | FRotator GetControlRotation() const;UFUNCTIONBlueprintCallableCategory=PawnGet the rotation of the Controller, often the 'view' rotation of this Pawn. |
| OnRep_Controller | virtual void OnRep_Controller();UFUNCTIONCalled when Controller is replicated |
| OnRep_PlayerState | virtual void OnRep_PlayerState();UFUNCTIONPlayerState Replication Notification Callback |
| GetVelocity | virtual FVector GetVelocity() const override; |
| Reset | virtual void Reset() override; |
| GetHumanReadableName | virtual FString GetHumanReadableName() const override; |
| ShouldTickIfViewportsOnly | virtual bool ShouldTickIfViewportsOnly() const override; |
| IsNetRelevantFor | |
| PostNetReceiveLocationAndRotation | virtual void PostNetReceiveLocationAndRotation() override; |
| PostNetReceiveVelocity | virtual void PostNetReceiveVelocity(const FVector& NewVelocity) override; |
| DisplayDebug | virtual void DisplayDebug(UCanvas* Canvas, const FDebugDisplayInfo& DebugDisplay, float& YL, float& YPos) override; |
| GetActorEyesViewPoint | virtual void GetActorEyesViewPoint(FVector& Location, FRotator& Rotation) const override; |
| OutsideWorldBounds | virtual void OutsideWorldBounds() override; |
| BeginPlay | virtual void BeginPlay() override; |
| Destroyed | virtual void Destroyed() override; |
| EndPlay | virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; |
| PreInitializeComponents | virtual void PreInitializeComponents() override; |
| PostInitializeComponents | virtual void PostInitializeComponents() override; |
| GetNetOwner | virtual const AActor* GetNetOwner() const override; |
| GetNetOwningPlayer | virtual UPlayer* GetNetOwningPlayer() override; |
| GetNetOwningPlayerAnyRole | virtual UPlayer* GetNetOwningPlayerAnyRole() override; |
| GetNetConnection | virtual class UNetConnection* GetNetConnection() const override; |
| PostLoad | virtual void PostLoad() override; |
| PostRegisterAllComponents | virtual void PostRegisterAllComponents() override; |
| TakeDamage | virtual float TakeDamage(float Damage, struct FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser) override; |
| BecomeViewTarget | virtual void BecomeViewTarget(APlayerController* PC) override; |
| EndViewTarget | virtual void EndViewTarget(APlayerController* PC) override; |
| EnableInput | virtual void EnableInput(APlayerController* PlayerController) override; |
| DisableInput | virtual void DisableInput(APlayerController* PlayerController) override; |
| TeleportSucceeded | virtual void TeleportSucceeded(bool bIsATest) override; |
| IsBasedOnActor | virtual bool IsBasedOnActor(const AActor* Other) const override; |
| CanBeBaseForCharacter | Overridden to defer to the RootComponent's CanCharacterStepUpOn setting if it is explicitly Yes or No. If set to Owner, will return Super::CanBeBaseForCharacter(). |
| SetCanAffectNavigationGeneration | void SetCanAffectNavigationGeneration(bool bNewValue, bool bForceUpdate = false);UFUNCTIONBlueprintCallableCategory=AI|NavigationUse SetCanAffectNavigationGeneration to change this value at runtime. Note that calling this function at runtime will result in any navigation change only if runtime navigation generation is enabled. |
| UpdateNavigationRelevance | virtual void UpdateNavigationRelevance();Update all components relevant for navigation generators to match bCanAffectNavigationGeneration flag |
| GetNavAgentPropertiesRef | virtual const FNavAgentProperties& GetNavAgentPropertiesRef() const override; |
| GetNavAgentLocation | virtual FVector GetNavAgentLocation() const override;UFUNCTIONBlueprintCallableCategory=PawnBasically retrieved pawn's location on navmesh |
| GetMoveGoalReachTest | virtual void GetMoveGoalReachTest(const AActor* MovingActor, const FVector& MoveOffset, FVector& GoalOffset, float& GoalRadius, float& GoalHalfHeight) const override; |
| UpdateNavAgent | void UpdateNavAgent();Updates MovementComponent's parameters used by navigation system |
| ShouldTakeDamage | virtual bool ShouldTakeDamage(float Damage, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser) const;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… |
| GetGravityDirection | virtual FVector GetGravityDirection() const;Returns vector direction of gravity |
| GetGravityTransform | virtual FQuat GetGravityTransform() const;Returns a quaternion transforming from world space into gravity relative space |
| SetPlayerDefaults | virtual void SetPlayerDefaults();Make sure pawn properties are back to default. |
| RecalculateBaseEyeHeight | virtual void RecalculateBaseEyeHeight();Set BaseEyeHeight based on current state. |
| InputEnabled | bool InputEnabled() const;Whether this Pawn's input handling is enabled. Pawn must still be possessed to get input even if this is true |
| PossessedBy | virtual void PossessedBy(AController* NewController);Called when this Pawn is possessed. Only called on the server (or in standalone). |
| ReceivePossessed | void ReceivePossessed(AController* NewController);UFUNCTIONBlueprintImplementableEventBlueprintAuthorityOnlyEvent called when the Pawn is possessed by a Controller. Only called on the server (or in standalone) |
| UnPossessed | virtual void UnPossessed();Called when our Controller no longer possesses us. Only called on the server (or in standalone). |
| ReceiveUnpossessed | void ReceiveUnpossessed(AController* OldController);UFUNCTIONBlueprintImplementableEventBlueprintAuthorityOnlyEvent called when the Pawn is no longer possessed by a Controller. Only called on the server (or in standalone) |
| ReceiveControllerChanged | void ReceiveControllerChanged(AController* OldController, AController* NewController);UFUNCTIONBlueprintImplementableEventEvent called after a pawn's controller has changed, on the server and owning client. This will happen at the same time as the delegate on GameInstance |
| NotifyControllerChanged | virtual void NotifyControllerChanged();Call to notify about a change in controller, on both the server and owning client. This calls the above event and delegate |
| ReceiveRestarted | void ReceiveRestarted();UFUNCTIONBlueprintImplementableEventEvent called after a pawn has been restarted, usually by a possession change. This is called on the server for all pawns and the owning client for player pawns |
| NotifyRestarted | virtual void NotifyRestarted();Notifies other systems that a pawn has been restarted. By default this is called on the server for all pawns and the owning client for player pawns. This can be overridden by subclasses to delay the notification of… |
| Restart | virtual void Restart();Called when the Pawn is being restarted (usually by being possessed by a Controller). This is called on the server for all pawns and the owning client for player pawns |
| PawnClientRestart | virtual void PawnClientRestart();Called on the owning client of a player-controlled Pawn when it is restarted, this calls Restart() |
| DispatchRestart | void DispatchRestart(bool bCallClientRestart);Wrapper function to call correct restart functions, enable bCallClientRestart if this is a locally owned player pawn or equivalent |
| IsLocallyControlled | virtual bool IsLocallyControlled() const;UFUNCTIONBlueprintPureCategory=PawnReturns true if controlled by a local (not network) Controller. |
| GetPlatformUserId | FPlatformUserId GetPlatformUserId() const;UFUNCTIONBlueprintCallableBlueprintPureCategory=PawnReturns the Platform User ID of the PlayerController that is controlling this character. |
| IsPlayerControlled | virtual bool IsPlayerControlled() const;UFUNCTIONBlueprintPureCategory=PawnReturns true if controlled by a human player (possessed by a PlayerController). This returns true for players controlled by remote clients |
| IsBotControlled | virtual bool IsBotControlled() const;UFUNCTIONBlueprintPureCategory=PawnReturns true if controlled by a bot. |
| GetViewRotation | virtual FRotator GetViewRotation() const;Get the view rotation of the Pawn (direction they are looking, normally Controller->ControlRotation). |
| GetPawnViewLocation | virtual FVector GetPawnViewLocation() const;Returns Pawn's eye location |
| GetBaseAimRotation | virtual FRotator GetBaseAimRotation() const;UFUNCTIONBlueprintCallableCategory=PawnReturn the aim rotation for the Pawn. If we have a controller, by default we aim at the player's 'eyes' direction that is by default the Pawn rotation for AI, and camera (crosshair) rotation for human players. |
| InFreeCam | virtual bool InFreeCam() const;Returns true if player is viewing this Pawn in FreeCam |
| FaceRotation | virtual void FaceRotation(FRotator NewControlRotation, float DeltaTime = 0.f);Updates Pawn's rotation to the given rotation, assumed to be the Controller's ControlRotation. Respects the bUseControllerRotation* settings. |
| DetachFromControllerPendingDestroy | virtual void DetachFromControllerPendingDestroy();UFUNCTIONBlueprintCallableCategory=PawnCall this function to detach safely pawn from its controller, knowing that we will be destroyed soon. |
| SpawnDefaultController | virtual void SpawnDefaultController();UFUNCTIONBlueprintCallableCategory=PawnSpawn default controller for this Pawn, and get possessed by it. |
| GetDamageInstigator | virtual AController* GetDamageInstigator(AController* InstigatedBy, const UDamageType& DamageType) const;protectedGet the controller instigating the damage. If the damage is caused by the world and the supplied controller is nullptr or is this pawn's controller, uses LastHitBy as the instigator. |
| CreatePlayerInputComponent | virtual UInputComponent* CreatePlayerInputComponent();protectedCreates an InputComponent that can be used for custom input bindings. Called upon possession by a PlayerController. Return null if you don't want one. |
| DestroyPlayerInputComponent | virtual void DestroyPlayerInputComponent();protectedDestroys the player input component and removes any references to it. |
| SetupPlayerInputComponent | virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent);protectedAllows a Pawn to set up custom input bindings. Called upon possession by a PlayerController, using the InputComponent created by CreatePlayerInputComponent(). |
| AddMovementInput | virtual void AddMovementInput(FVector WorldDirection, float ScaleValue = 1.0f, bool bForce = false);UFUNCTIONBlueprintCallableCategory=Pawn|InputAdd movement input along the given world direction vector (usually normalized) scaled by 'ScaleValue'. If ScaleValue < 0, movement will be in the opposite direction. Base Pawn classes won't automatically apply… |
| GetPendingMovementInputVector | FVector GetPendingMovementInputVector() const;UFUNCTIONBlueprintCallableCategory=Pawn|InputReturn the pending input vector in world space. This is the most up-to-date value of the input vector, pending ConsumeMovementInputVector() which clears it, Usually only a PawnMovementComponent will want to read this… |
| GetLastMovementInputVector | FVector GetLastMovementInputVector() const;UFUNCTIONBlueprintCallableCategory=Pawn|InputReturn the last input vector in world space that was processed by ConsumeMovementInputVector(), which is usually done by the Pawn or PawnMovementComponent. Any user that needs to know about the input that last… |
| ConsumeMovementInputVector | virtual FVector ConsumeMovementInputVector();UFUNCTIONBlueprintCallableCategory=Pawn|InputReturns the pending input vector and resets it to zero. This should be used during a movement update (by the Pawn or PawnMovementComponent) to prevent accumulation of control input between frames. Copies the pending… |
| AddControllerPitchInput | virtual void AddControllerPitchInput(float Val);UFUNCTIONBlueprintCallableCategory=Pawn|InputAdd input (affecting Pitch) to the Controller's ControlRotation, if it is a local PlayerController. This value is multiplied by the PlayerController's InputPitchScale value. |
| AddControllerYawInput | virtual void AddControllerYawInput(float Val);UFUNCTIONBlueprintCallableCategory=Pawn|InputAdd input (affecting Yaw) to the Controller's ControlRotation, if it is a local PlayerController. This value is multiplied by the PlayerController's InputYawScale value. |
| AddControllerRollInput | virtual void AddControllerRollInput(float Val);UFUNCTIONBlueprintCallableCategory=Pawn|InputAdd input (affecting Roll) to the Controller's ControlRotation, if it is a local PlayerController. This value is multiplied by the PlayerController's InputRollScale value. |
| IsMoveInputIgnored | virtual bool IsMoveInputIgnored() const;UFUNCTIONBlueprintCallableCategory=Pawn|InputHelper to see if move input is ignored. If our controller is a PlayerController, checks Controller->IsMoveInputIgnored(). |
| GetOverrideInputComponentClass | TSubclassOf<UInputComponent> GetOverrideInputComponentClass() const;UFUNCTIONBlueprintCallableCategory=Pawn|Input |
| Internal_AddMovementInput | void Internal_AddMovementInput(FVector WorldAccel, bool bForce = false);Internal function meant for use only within Pawn or by a PawnMovementComponent. Adds movement input if not ignored, or if forced. |
| Internal_GetPendingMovementInputVector | inline FVector Internal_GetPendingMovementInputVector() const;Internal function meant for use only within Pawn or by a PawnMovementComponent. Returns the value of ControlInputVector. |
| Internal_GetLastMovementInputVector | inline FVector Internal_GetLastMovementInputVector() const;Internal function meant for use only within Pawn or by a PawnMovementComponent. Returns the value of LastControlInputVector. |
| Internal_ConsumeMovementInputVector | FVector Internal_ConsumeMovementInputVector();Internal function meant for use only within Pawn or by a PawnMovementComponent. LastControlInputVector is updated with initial value of ControlInputVector. Returns ControlInputVector and resets it to zero. |
| MoveIgnoreActorAdd | void MoveIgnoreActorAdd(AActor* ActorToIgnore);Add an Actor to ignore by Pawn's movement collision |
| MoveIgnoreActorRemove | void MoveIgnoreActorRemove(AActor* ActorToIgnore);Remove an Actor to ignore by Pawn's movement collision |
Static functions 1
| GetMovementBaseActor | Gets the owning actor of the Movement Base Component on which the pawn is standing. |
Functions
Free functions 1
| GetController | AController* APawn::GetController() const;Pawn inlines |