Class Pawn
Pawn is the base class of all actors that can be possessed by players or AI.
Inherited Members
Namespace: UE4.Engine
Assembly: UE4DotNet.dll
Syntax
public class Pawn : Actor
Remarks
They are the physical representations of players and creatures in a level.
@see https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Pawn/
Properties
| Improve this Doc View SourceAIControllerClass
Default class to use when pawn is controlled by AI.
Declaration
public SubclassOf<Controller> AIControllerClass { get; set; }
Property Value
Type | Description |
---|---|
SubclassOf<Controller> |
AutoPossessPlayer
Determines which PlayerController, if any, should automatically possess the pawn when the level starts or when the pawn is spawned.
Declaration
public byte AutoPossessPlayer { get; set; }
Property Value
Type | Description |
---|---|
System.Byte |
Remarks
@see AutoPossessAI
BaseEyeHeight
Base eye height above collision center.
Declaration
public float BaseEyeHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
bCanAffectNavigationGeneration
Declaration
public bool bCanAffectNavigationGeneration { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
bUseControllerRotationPitch
Declaration
public bool bUseControllerRotationPitch { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
bUseControllerRotationRoll
Declaration
public bool bUseControllerRotationRoll { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
bUseControllerRotationYaw
Declaration
public bool bUseControllerRotationYaw { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ControlInputVector
Accumulated control input vector, stored in world space.
Declaration
public Vector ControlInputVector { get; set; }
Property Value
Type | Description |
---|---|
Vector |
Remarks
This is the pending input, which is cleared (zeroed) once consumed. @see GetPendingMovementInputVector(), AddMovementInput()
Controller
Controller currently possessing this Actor
Declaration
public Controller Controller { get; set; }
Property Value
Type | Description |
---|---|
Controller |
DefaultObject
Get UE4 Default Object for this Class
Declaration
public static Pawn DefaultObject { get; }
Property Value
Type | Description |
---|---|
Pawn |
LastControlInputVector
The last control input vector that was processed by ConsumeMovementInputVector().
Declaration
public Vector LastControlInputVector { get; set; }
Property Value
Type | Description |
---|---|
Vector |
Remarks
@see GetLastMovementInputVector()
LastHitBy
Controller of the last Actor that caused us damage.
Declaration
public Controller LastHitBy { get; }
Property Value
Type | Description |
---|---|
Controller |
PlayerState
If Pawn is possessed by a player, points to its Player State. Needed for network play as controllers are not replicated to clients.
Declaration
public PlayerState PlayerState { get; }
Property Value
Type | Description |
---|---|
PlayerState |
RemoteViewPitch
Replicated so we can see where remote clients are looking.
Declaration
public byte RemoteViewPitch { get; set; }
Property Value
Type | Description |
---|---|
System.Byte |
StaticClass
Get UE4 Class
Declaration
public static Class StaticClass { get; }
Property Value
Type | Description |
---|---|
Class |
Methods
| Improve this Doc View SourceAddControllerPitchInput(Single)
Add input (affecting Pitch) to the Controller's ControlRotation, if it is a local PlayerController.
Declaration
public void AddControllerPitchInput(float Val)
Parameters
Type | Name | Description |
---|---|---|
System.Single | Val |
Remarks
This value is multiplied by the PlayerController's InputPitchScale value. @param Val Amount to add to Pitch. This value is multiplied by the PlayerController's InputPitchScale value. @see PlayerController::InputPitchScale
AddControllerRollInput(Single)
Add input (affecting Roll) to the Controller's ControlRotation, if it is a local PlayerController.
Declaration
public void AddControllerRollInput(float Val)
Parameters
Type | Name | Description |
---|---|---|
System.Single | Val |
Remarks
This value is multiplied by the PlayerController's InputRollScale value. @param Val Amount to add to Roll. This value is multiplied by the PlayerController's InputRollScale value. @see PlayerController::InputRollScale
AddControllerYawInput(Single)
Add input (affecting Yaw) to the Controller's ControlRotation, if it is a local PlayerController.
Declaration
public void AddControllerYawInput(float Val)
Parameters
Type | Name | Description |
---|---|---|
System.Single | Val |
Remarks
This value is multiplied by the PlayerController's InputYawScale value. @param Val Amount to add to Yaw. This value is multiplied by the PlayerController's InputYawScale value. @see PlayerController::InputYawScale
AddMovementInput(Vector, Single, Boolean)
Declaration
public void AddMovementInput(Vector WorldDirection, float ScaleValue, bool bForce)
Parameters
Type | Name | Description |
---|---|---|
Vector | WorldDirection | |
System.Single | ScaleValue | |
System.Boolean | bForce |
ConsumeMovementInputVector()
Returns the pending input vector and resets it to zero.
Declaration
public Vector ConsumeMovementInputVector()
Returns
Type | Description |
---|---|
Vector |
Remarks
This should be used during a movement update (by the Pawn or PawnMovementComponent) to prevent accumulation of control input between frames. Copies the pending input vector to the saved input vector (GetLastMovementInputVector()). @return The pending input vector.
DetachFromControllerPendingDestroy()
Call this function to detach safely pawn from its controller, knowing that we will be destroyed soon.
Declaration
public void DetachFromControllerPendingDestroy()
GetBaseAimRotation()
Return the aim rotation for the Pawn.
Declaration
public Rotator GetBaseAimRotation()
Returns
Type | Description |
---|---|
Rotator |
Remarks
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.
GetController()
Returns controller for this actor.
Declaration
public Controller GetController()
Returns
Type | Description |
---|---|
Controller |
GetControlRotation()
Get the rotation of the Controller, often the 'view' rotation of this Pawn.
Declaration
public Rotator GetControlRotation()
Returns
Type | Description |
---|---|
Rotator |
GetLastMovementInputVector()
Return the last input vector in world space that was processed by ConsumeMovementInputVector(), which is usually done by the Pawn or PawnMovementComponent.
Declaration
public Vector GetLastMovementInputVector()
Returns
Type | Description |
---|---|
Vector |
Remarks
Any user that needs to know about the input that last affected movement should use this function. For example an animation update would want to use this, since by default the order of updates in a frame is: PlayerController (device input) -> MovementComponent -> Pawn -> Mesh (animations)
@return The last input vector in world space that was processed by ConsumeMovementInputVector(). @see AddMovementInput(), GetPendingMovementInputVector(), ConsumeMovementInputVector()
GetMovementBaseActor(Pawn)
Gets the owning actor of the Movement Base Component on which the pawn is standing.
Declaration
public static Actor GetMovementBaseActor(Pawn Pawn)
Parameters
Type | Name | Description |
---|---|---|
Pawn | Pawn |
Returns
Type | Description |
---|---|
Actor |
GetMovementComponent()
Return our PawnMovementComponent, if we have one.
Declaration
public PawnMovementComponent GetMovementComponent()
Returns
Type | Description |
---|---|
PawnMovementComponent |
GetNavAgentLocation()
Basically retrieved pawn's location on navmesh
Declaration
public Vector GetNavAgentLocation()
Returns
Type | Description |
---|---|
Vector |
GetPendingMovementInputVector()
Return the pending input vector in world space.
Declaration
public Vector GetPendingMovementInputVector()
Returns
Type | Description |
---|---|
Vector |
Remarks
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 value, or the Pawn itself if it is responsible for movement.
@return The pending input vector in world space. @see AddMovementInput(), GetLastMovementInputVector(), ConsumeMovementInputVector()
IsControlled()
See if this actor is currently being controlled
Declaration
public bool IsControlled()
Returns
Type | Description |
---|---|
System.Boolean |
IsLocallyControlled()
@return true if controlled by a local (not network) Controller.
Declaration
public bool IsLocallyControlled()
Returns
Type | Description |
---|---|
System.Boolean |
IsMoveInputIgnored()
Helper to see if move input is ignored. If our controller is a PlayerController, checks Controller->IsMoveInputIgnored().
Declaration
public bool IsMoveInputIgnored()
Returns
Type | Description |
---|---|
System.Boolean |
IsPlayerControlled()
@return true if controlled by a human player (possessed by a PlayerController).
Declaration
public bool IsPlayerControlled()
Returns
Type | Description |
---|---|
System.Boolean |
K2_GetMovementInputVector()
(Deprecated) Return the input vector in world space.
Declaration
public Vector K2_GetMovementInputVector()
Returns
Type | Description |
---|---|
Vector |
LaunchPawn(Vector, Boolean, Boolean)
Launch Pawn
Declaration
public void LaunchPawn(Vector LaunchVelocity, bool bXYOverride, bool bZOverride)
Parameters
Type | Name | Description |
---|---|---|
Vector | LaunchVelocity | |
System.Boolean | bXYOverride | |
System.Boolean | bZOverride |
New(UObject, Name)
Spawn an object of this class
Declaration
public static Pawn New(UObject obj = null, Name name = default(Name))
Parameters
Type | Name | Description |
---|---|---|
UObject | obj | |
Name | name |
Returns
Type | Description |
---|---|
Pawn |
PawnMakeNoise(Single, Vector, Boolean, Actor)
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.
Declaration
public void PawnMakeNoise(float Loudness, Vector NoiseLocation, bool bUseNoiseMakerLocation, Actor NoiseMaker)
Parameters
Type | Name | Description |
---|---|---|
System.Single | Loudness | |
Vector | NoiseLocation | |
System.Boolean | bUseNoiseMakerLocation | |
Actor | NoiseMaker |
Remarks
@param Loudness - is the relative loudness of this noise (range 0.0 to 1.0). Directly affects the hearing range specified by the AI's HearingThreshold. @param NoiseLocation - Position of noise source. If zero vector, use the actor's location. @param bUseNoiseMakerLocation - If true, use the location of the NoiseMaker rather than NoiseLocation. If false, use NoiseLocation. @param NoiseMaker - Which actor is the source of the noise. Not to be confused with the Noise Instigator, which is responsible for the noise (and is the pawn on which this function is called). If not specified, the pawn instigating the noise will be used as the NoiseMaker
SetCanAffectNavigationGeneration(Boolean, Boolean)
Use SetCanAffectNavigationGeneration to change this value at runtime.
Declaration
public void SetCanAffectNavigationGeneration(bool bNewValue, bool bForceUpdate)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | bNewValue | |
System.Boolean | bForceUpdate |
Remarks
Note that calling this function at runtime will result in any navigation change only if runtime navigation generation is enabled.
SpawnDefaultController()
Spawn default controller for this Pawn, and get possessed by it.
Declaration
public void SpawnDefaultController()
Events
| Improve this Doc View SourceReceivePossessed
Event called when the Pawn is possessed by a Controller (normally only occurs on the server/standalone).
Declaration
public event Pawn.ReceivePossessed_delegate ReceivePossessed
Event Type
Type | Description |
---|---|
Pawn.ReceivePossessed_delegate |
ReceiveUnpossessed
Event called when the Pawn is no longer possessed by a Controller.
Declaration
public event Pawn.ReceiveUnpossessed_delegate ReceiveUnpossessed
Event Type
Type | Description |
---|---|
Pawn.ReceiveUnpossessed_delegate |
Operators
| Improve this Doc View SourceImplicit(IntPtr to Pawn)
Convert from IntPtr to UObject
Declaration
public static implicit operator Pawn(IntPtr p)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | p |
Returns
Type | Description |
---|---|
Pawn |