Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/GameFramework
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- AActor
- APawn
- ACharacter
- AArchVisCharacter
- AEQSTestingPawn
- PAPER2APaperCharacter
References
| Module | Engine |
| Header | /Engine/Source/Runtime/Engine/Classes/GameFramework/Character.h |
| Include | #include "GameFramework/Character.h" |
Syntax
class ACharacter : public APawn
Remarks
Characters are Pawns that have a mesh, collision, and built-in movement logic. They are responsible for all physical interaction between the player or AI and the world, and also implement basic networking and input models. They are designed for a vertically-oriented player representation that can walk, jump, fly, and swim through the world using CharacterMovementComponent.
Variables
| Type | Name | Description | |
|---|---|---|---|
| float | AnimRootMotionTranslationScale | Scale to apply to root motion translation on this Character | |
| FBasedMovementInfo | BasedMovement | Info about our current movement base (object we are standing on). | |
| FQuat | BaseRotationOffset | Saved rotation offset of mesh. | |
| FVector | BaseTranslationOffset | Saved translation offset of mesh. | |
| uint32: 1 | bClientCheckEncroachmentOnNetUpdate | ||
| uint32: 1 | bClientResimulateRootMotion | If server disagrees with root motion track position, client has to resimulate root motion from last AckedMove. | |
| uint32: 1 | bClientResimulateRootMotionSources | If server disagrees with root motion state, client has to resimulate root motion from last AckedMove. | |
| uint32: 1 | bClientUpdating | When true, applying updates to network client (replaying saved moves for a locally controlled character) | |
| uint32: 1 | bClientWasFalling | True if Pawn was initially falling when started to replay network moves. | |
| bool | bInBaseReplication | Flag that we are receiving replication of the based movement. | |
| uint32: 1 | bIsCrouched | Set by character movement to specify that this Character is currently crouched. | |
| uint32: 1 | bPressedJump | When true, player wants to jump | |
| uint32: 1 | bProxyIsJumpForceApplied | Set to indicate that this Character is currently under the force of a jump (if JumpMaxHoldTime is non-zero). | |
| uint32: 1 | bServerMoveIgnoreRootMotion | Disable root motion on the server. | |
| uint32: 1 | bSimGravityDisabled | Disable simulated gravity (set when character encroaches geometry on client, to keep it from falling through floors) | |
| uint32: 1 | bWasJumping | Tracks whether or not the character was already jumping last frame. | |
| FRootMotionMovementParams | ClientRootMotionParams | For LocallyControlled Autonomous clients. Saved root motion data to be used by SavedMoves. | |
| float | CrouchedEyeHeight | Default crouched eye height | |
| int32 | JumpCurrentCount | Tracks the current number of jumps performed. | |
| int32 | JumpCurrentCountPreJump | Represents the current number of jumps performed before CheckJumpInput modifies JumpCurrentCount. | |
| float | JumpForceTimeRemaining | Amount of jump force time remaining, if JumpMaxHoldTime > 0. | |
| float | JumpKeyHoldTime | Jump key Held Time. This is the time that the player has held the jump key, in seconds. | |
| int32 | JumpMaxCount | The max number of jumps the character can perform. | |
| float | JumpMaxHoldTime | The max time the jump key can be held. | |
| FLandedSignature | LandedDelegate | Called upon landing when falling, to perform actions based on the Hit result. | |
| FMovementModeChangedSignature | MovementModeChangedDelegate | Multicast delegate for MovementMode changing. | |
| uint32 | NumActorOverlapEventsCounter | Incremented every time there is an Actor overlap event (start or stop) on this actor. | |
| FCharacterMovementUpdatedSignature | OnCharacterMovementUpdated | Event triggered at the end of a CharacterMovementComponent movement update. | |
| FCharacterReachedApexSignature | OnReachedJumpApex | Broadcast when Character's jump reaches its apex. Needs CharacterMovement->bNotifyApex = true | |
| FVector_NetQuantizeNormal | PreNetReceivedGravityDirection | Cached version of the replicated gravity direction before replication. | |
| float | ProxyJumpForceStartedTime | Track last time a jump force started for a proxy. | |
| float | ReplayLastTransformUpdateTimeStamp | ||
| FBasedMovementInfo | ReplicatedBasedMovement | Replicated version of relative movement. Read-only on simulated proxies! | |
| FVector_NetQuantizeNormal | ReplicatedGravityDirection | CharacterMovement Custom gravity direction replicated for simulated proxies. | |
| uint8 | ReplicatedMovementMode | CharacterMovement MovementMode (and custom mode) replicated for simulated proxies. | |
| float | ReplicatedServerLastTransformUpdateTimeStamp | CharacterMovement ServerLastTransformUpdateTimeStamp value, replicated to simulated proxies. | |
| FRepRootMotionMontage | RepRootMotion | Replicated Root Motion montage | |
| TArray< FSimulatedRootMotionReplicatedMove > | RootMotionRepMoves | Array of previously received root motion moves from the server. | |
| FRootMotionSourceGroup | SavedRootMotion | For LocallyControlled Autonomous clients. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
ACharacter
(
const FObjectInitializer& ObjectInitializer |
Default UObject constructor. |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | ApplyAsyncOutput
(
const FCharacterAsyncOutput& Output |
||
| void | ApplyDamageMomentum
(
float DamageTaken, |
Apply momentum caused by damage. | |
| void | BaseChange () |
Event called after actor's base changes (if SetBase was requested to notify us with bNotifyPawn). | |
| void | CacheInitialMeshOffset
(
FVector MeshRelativeLocation, |
Cache mesh offset from capsule. | |
| bool | CanCrouch () |
||
| bool | CanJump () |
Check if the character can jump in the current state. | |
| bool | Customizable event to check if the character can jump in the current state. | ||
| bool | Customizable event to check if the character can jump in the current state. | ||
| bool | CanUseRootMotionRepMove
(
const FSimulatedRootMotionReplicatedMove& RootMotionRepMove, |
True if buffered move is usable to teleport client back to. | |
| void | CheckJumpInput
(
float DeltaTime |
Trigger jump if jump button has been pressed. | |
| void | ClearJumpInput
(
float DeltaTime |
Update jump input state after having checked input. | |
| void | ClientAckGoodMove
(
float TimeStamp |
If no client adjustment is needed after processing received ServerMove(), ack the good move so client can remove it from SavedMoves | |
| void | ClientAckGoodMove_Implementation
(
float TimeStamp |
If no client adjustment is needed after processing received ServerMove(), ack the good move so client can remove it from SavedMoves | |
| void | ClientAdjustPosition
(
float TimeStamp, |
Replicate position correction to client, associated with a timestamped servermove. | |
| void | ClientAdjustPosition_Implementation
(
float TimeStamp, |
Replicate position correction to client, associated with a timestamped servermove. | |
| void | ClientAdjustRootMotionPosition
(
float TimeStamp, |
Replicate position correction to client when using root motion for movement. | |
| void | ClientAdjustRootMotionPosition_Implementation
(
float TimeStamp, |
Replicate position correction to client when using root motion for movement. | |
| void | ClientAdjustRootMotionSourcePosition
(
float TimeStamp, |
Replicate root motion source correction to client when using root motion for movement. | |
| void | ClientAdjustRootMotionSourcePosition_Implementation
(
float TimeStamp, |
Replicate root motion source correction to client when using root motion for movement. | |
| void | |||
| void | |||
| void | |||
| void | |||
| void | |||
| void | |||
| void | ClientMoveResponsePacked
(
const FCharacterMoveResponsePackedBits& PackedBits |
Client RPC that passes through to CharacterMovement (avoids RPC overhead for components). | |
| void | ClientMoveResponsePacked_Implementation
(
const FCharacterMoveResponsePackedBits& PackedBits |
Client RPC that passes through to CharacterMovement (avoids RPC overhead for components). | |
| bool | ClientMoveResponsePacked_Validate
(
const FCharacterMoveResponsePackedBits& PackedBits |
Client RPC that passes through to CharacterMovement (avoids RPC overhead for components). | |
| void | ClientVeryShortAdjustPosition
(
float TimeStamp, |
Bandwidth saving version, when velocity is zeroed | |
| void | ClientVeryShortAdjustPosition_Implementation
(
float TimeStamp, |
Bandwidth saving version, when velocity is zeroed | |
| void | Crouch
(
bool bClientSimulation |
Request the character to start crouching. | |
| void | Falling () |
Called when the character's movement enters falling | |
| void | FillAsyncInput
(
FCharacterAsyncInput& Input |
Async simulation API | |
| T * | |||
| int32 | FindRootMotionRepMove
(
const FAnimMontageInstance& ClientMontageInstance |
Find usable root motion replicated move from our buffer. | |
| float | Returns current value of AnimRootMotionScale | ||
| UArrowComponent * | Returns ArrowComponent subobject | ||
| const FBasedMovementInfo & | Accessor for BasedMovement | ||
| FQuat | Get the saved rotation offset of mesh. | ||
| FRotator | Get the saved rotation offset of mesh. | ||
| FVector | Get the saved translation offset of mesh. | ||
| UCapsuleComponent * | Returns CapsuleComponent subobject | ||
| T * | Returns CharacterMovement subobject | ||
| UCharacterMovementComponent * | |||
| UAnimMontage * | Return current playing Montage | ||
| float | Get the maximum jump time for the character. | ||
| USkeletalMeshComponent * | GetMesh () |
END DEPRECATED RPCs. | |
| const FBasedMovementInfo & | Accessor for ReplicatedBasedMovement | ||
| FVector | Returns replicated gravity direction for simulated proxies | ||
| uint8 | Returns ReplicatedMovementMode | ||
| float | Accessor for ReplicatedServerLastTransformUpdateTimeStamp. | ||
| FAnimMontageInstance * | Get FAnimMontageInstance playing RootMotion | ||
| bool | True if we are playing root motion from any source right now (anim root motion, root motion source) | ||
| void | InitializeAsyncOutput
(
FCharacterAsyncOutput& Output |
||
| bool | True if jump is actively providing a force, such as when the jump key is held and the time it has been held is less than JumpMaxHoldTime. | ||
| bool | True if we are playing Root Motion right now, through a Montage with RootMotionMode == ERootMotionMode::RootMotionFromMontagesOnly. | ||
| bool | True if we are playing Anim root motion right now | ||
| void | Jump () |
Make the character jump on the next update. | |
| bool | |||
| void | K2_OnEndCrouch
(
float HalfHeightAdjust, |
Event when Character stops crouching. | |
| void | K2_OnMovementModeChanged
(
EMovementMode PrevMovementMode, |
Called from CharacterMovementComponent to notify the character that the movement mode has changed. | |
| void | K2_OnStartCrouch
(
float HalfHeightAdjust, |
Event when Character crouches. | |
| void | K2_UpdateCustomMovement
(
float DeltaTime |
Event for implementing custom character movement mode. | |
| void | Landed
(
const FHitResult& Hit |
Called upon landing when falling, to perform actions based on the Hit result. | |
| void | LaunchCharacter
(
FVector LaunchVelocity, |
Set a pending launch velocity on the Character. | |
| void | MoveBlockedBy
(
const FHitResult& Impact |
Called when pawn's movement is blocked | |
| void | Called when character's jump reaches Apex. Needs CharacterMovement->bNotifyApex = true | ||
| void | OnEndCrouch
(
float HalfHeightAdjust, |
Called when Character stops crouching. | |
| void | OnJumped () |
Event fired when the character has just started jumping | |
| void | Event fired when the character has just started jumping | ||
| void | OnLanded
(
const FHitResult& Hit |
Called upon landing when falling, to perform actions based on the Hit result. | |
| void | OnLaunched
(
FVector LaunchVelocity, |
Let blueprint know that we were launched | |
| void | OnMovementModeChanged
(
EMovementMode PrevMovementMode, |
Called from CharacterMovementComponent to notify the character that the movement mode has changed. | |
| void | Handle Crouching replicated from server | ||
| void | |||
| void | Rep notify for ReplicatedBasedMovement | ||
| void | Handles replicated root motion properties on simulated proxies and position correction. | ||
| void | OnStartCrouch
(
float HalfHeightAdjust, |
Called when Character crouches. Called on non-owned Characters through bIsCrouched replication. | |
| void | OnUpdateSimulatedPosition
(
const FVector& OldLocation, |
Called on client after position update is received to respond to the new location and rotation. | |
| void | OnWalkingOffLedge
(
const FVector& PreviousFloorImpactNormal, |
Event fired when the Character is walking off a surface and is about to fall because CharacterMovement->CurrentFloor became unwalkable. | |
| void | OnWalkingOffLedge_Implementation
(
const FVector& PreviousFloorImpactNormal, |
Event fired when the Character is walking off a surface and is about to fall because CharacterMovement->CurrentFloor became unwalkable. | |
| float | PlayAnimMontage
(
UAnimMontage* AnimMontage, |
Play Animation Montage on the character mesh. | |
| void | Calculates the crouched eye height based on movement component settings | ||
| void | Marks character as not trying to jump | ||
| bool | RestoreReplicatedMove
(
const FSimulatedRootMotionReplicatedMove& RootMotionRepMove |
Restore actor to an old buffered move. | |
| void | RootMotionDebugClientPrintOnScreen
(
const FString& InString |
||
| void | RootMotionDebugClientPrintOnScreen_Implementation
(
const FString& InString |
||
| void | SaveRelativeBasedMovement
(
const FVector& NewRelativeLocation, |
Save a new relative location in BasedMovement and a new rotation with is either relative or absolute. | |
| void | ServerMove
(
float TimeStamp, |
BEGIN DEPRECATED RPCs that don't use variable sized payloads. Use ServerMovePacked and ClientMoveResponsePacked instead. | |
| void | ServerMove_Implementation
(
float TimeStamp, |
BEGIN DEPRECATED RPCs that don't use variable sized payloads. Use ServerMovePacked and ClientMoveResponsePacked instead. | |
| bool | ServerMove_Validate
(
float TimeStamp, |
BEGIN DEPRECATED RPCs that don't use variable sized payloads. Use ServerMovePacked and ClientMoveResponsePacked instead. | |
| void | ServerMoveDual
(
float TimeStamp0, |
Replicated function sent by client to server - contains client movement and view info for two moves. | |
| void | ServerMoveDual_Implementation
(
float TimeStamp0, |
Replicated function sent by client to server - contains client movement and view info for two moves. | |
| bool | ServerMoveDual_Validate
(
float TimeStamp0, |
Replicated function sent by client to server - contains client movement and view info for two moves. | |
| void | ServerMoveDualHybridRootMotion
(
float TimeStamp0, |
Replicated function sent by client to server - contains client movement and view info for two moves. | |
| void | ServerMoveDualHybridRootMotion_Implementation
(
float TimeStamp0, |
Replicated function sent by client to server - contains client movement and view info for two moves. | |
| bool | ServerMoveDualHybridRootMotion_Validate
(
float TimeStamp0, |
Replicated function sent by client to server - contains client movement and view info for two moves. | |
| void | ServerMoveDualNoBase
(
float TimeStamp0, |
Replicated function sent by client to server - contains client movement and view info for two moves. | |
| void | ServerMoveDualNoBase_Implementation
(
float TimeStamp0, |
Replicated function sent by client to server - contains client movement and view info for two moves. | |
| bool | ServerMoveDualNoBase_Validate
(
float TimeStamp0, |
Replicated function sent by client to server - contains client movement and view info for two moves. | |
| void | ServerMoveNoBase
(
float TimeStamp, |
Replicated function sent by client to server. | |
| void | ServerMoveNoBase_Implementation
(
float TimeStamp, |
Replicated function sent by client to server. | |
| bool | ServerMoveNoBase_Validate
(
float TimeStamp, |
Replicated function sent by client to server. | |
| void | ServerMoveOld
(
float OldTimeStamp, |
Resending an (important) old move. Process it if not already processed. | |
| void | ServerMoveOld_Implementation
(
float OldTimeStamp, |
Resending an (important) old move. Process it if not already processed. | |
| bool | ServerMoveOld_Validate
(
float OldTimeStamp, |
Resending an (important) old move. Process it if not already processed. | |
| void | ServerMovePacked
(
const FCharacterServerMovePackedBits& PackedBits |
Server RPC that passes through to CharacterMovement (avoids RPC overhead for components). | |
| void | ServerMovePacked_Implementation
(
const FCharacterServerMovePackedBits& PackedBits |
Server RPC that passes through to CharacterMovement (avoids RPC overhead for components). | |
| bool | ServerMovePacked_Validate
(
const FCharacterServerMovePackedBits& PackedBits |
Server RPC that passes through to CharacterMovement (avoids RPC overhead for components). | |
| void | SetAnimRootMotionTranslationScale
(
float InAnimRootMotionTranslationScale |
Sets scale to apply to root motion translation on this Character | |
| void | SetBase
(
UPrimitiveComponent* NewBase, |
Sets the component the Character is walking on, used by CharacterMovement walking movement to be able to follow dynamic objects. | |
| bool | ShouldNotifyLanded
(
const FHitResult& Hit |
Returns true if the Landed() event should be called. | |
| void | SimulatedRootMotionPositionFixup
(
float DeltaSeconds |
Position fix up for Simulated Proxies playing Root Motion | |
| void | StopAnimMontage
(
UAnimMontage* AnimMontage |
Stop Animation Montage. | |
| void | StopJumping () |
Stop the character from jumping on the next update. | |
| void | UnCrouch
(
bool bClientSimulation |
Request the character to stop crouching. |
Overridden from APawn
| Type | Name | Description | |
|---|---|---|---|
| void | DisplayDebug
(
UCanvas* Canvas, |
||
| 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 | ||
| UPrimitiveComponent * | Return PrimitiveComponent we are based on (standing on, attached to, and moving on). | ||
| UPawnMovementComponent * | Return our PawnMovementComponent, if we have one. | ||
| void | Called on the owning client of a player-controlled Pawn when it is restarted, this calls Restart() | ||
| void | PossessedBy
(
AController* NewController |
Called when this Pawn is possessed. Only called on the server (or in standalone). | |
| void | Set BaseEyeHeight based on current state. | ||
| void | Restart () |
Called when the Pawn is being restarted (usually by being possessed by a Controller). | |
| void | SetupPlayerInputComponent
(
UInputComponent* PlayerInputComponent |
Allows a Pawn to set up custom input bindings. | |
| 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 | Update all components relevant for navigation generators to match bCanAffectNavigationGeneration flag |
Overridden from AActor
| Type | Name | Description | |
|---|---|---|---|
| void | BeginPlay () |
Overridable native event for when play begins for this actor. | |
| void | Do anything needed to clear out cross level references; Called from ULevel::PreSave | ||
| UActorComponent * | FindComponentByClass
(
const TSubclassOf< UActorComponent > ComponentClass |
Searches components array and returns first encountered component of the specified class, native version of GetComponentByClass | |
| void | GetSimpleCollisionCylinder
(
float& CollisionRadius, |
Get axis-aligned cylinder around this actor, used for simple collision checks (ie Pawns reaching a destination). | |
| void | NotifyActorBeginOverlap
(
AActor* OtherActor |
Event when this actor overlaps another actor, for example a player walking into a trigger. | |
| void | NotifyActorEndOverlap
(
AActor* OtherActor |
Event when an actor no longer overlaps another actor, and they have separated. | |
| void | ReplicatedMovement struct replication event | ||
| 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 | PreReplication
(
IRepChangedPropertyTracker& ChangedPropertyTracker |
Called on the actor right before replication occurs. | |
| void | PreReplicationForReplay
(
IRepChangedPropertyTracker& ChangedPropertyTracker |
Called on the actor right before replication occurs. | |
| void | SetReplicateMovement
(
bool bInReplicateMovement |
Set whether this actor's movement replicates to network clients. | |
| void | TornOff () |
Networking - called on client when actor is torn off (bTearOff==true), meaning it's no longer replicated to clients. |
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 | GetReplicatedCustomConditionState
(
FCustomPropertyConditionState& OutActiveState |
Called when this actor begins replicating to initialize the state of custom property conditions | |
| void | PostLoad () |
Do any object-specific cleanup required immediately after loading an object. | |
| void | Always called immediately after properties are received from the remote. | ||
| void | Always called immediately before properties are received from the remote. |
Overridden from INavAgentInterface
| Type | Name | Description | |
|---|---|---|---|
| FVector | Basically retrieved pawn's location on navmesh |
Constants
| Name | Description |
|---|---|
| CapsuleComponentName | Name of the CapsuleComponent. |
| CharacterMovementComponentName | Name of the CharacterMovement component. |
| MeshComponentName | Name of the MeshComponent. |
See Also
https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Pawn/Character/