Header <GameFramework/CharacterMovementComponent.h>

#include "GameFramework/CharacterMovementComponent.h"
Module: Engine Source: Engine/Source/Runtime/Engine/Classes/GameFramework/CharacterMovementComponent.h

Includes 18

<CoreMinimal.h>
<Math/RandomStream.h>
<UObject/ObjectMacros.h>
<UObject/UObjectGlobals.h>
<Engine/NetSerialization.h>
<Engine/EngineTypes.h>
<Engine/EngineBaseTypes.h>
<WorldCollision.h>
<AI/Navigation/NavigationTypes.h>
<Animation/AnimationAsset.h>
<Animation/AnimMontage.h>
<GameFramework/RootMotionSource.h>
<AI/Navigation/NavigationAvoidanceTypes.h>
<AI/RVOAvoidanceInterface.h>
<GameFramework/PawnMovementComponent.h>
<GameFramework/CharacterMovementReplication.h>
<Interfaces/NetworkPredictionInterface.h>
<CharacterMovementComponentAsync.h>

Contents

UCharacterMovementComponent
CharacterMovementComponent handles movement logic for the associated Character owner. It supports various movement modes including: walking, falling, swimming, flying, custom.
(uclass class : UPawnMovementComponent)
Functions5 free functions
(namespace scope)

class UCharacterMovementComponent

class UCharacterMovementComponent : public UPawnMovementComponent, public IRVOAvoidanceInterface, public INetworkPredictionInterfaceUCLASSMinimalAPI
CharacterMovementComponent handles movement logic for the associated Character owner. It supports various movement modes including: walking, falling, swimming, flying, custom.

Constructors 1

UCharacterMovementComponent
UCharacterMovementComponent(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
Default UObject constructor.

Member functions 299

ComputeAnalogInputModifier
virtual float ComputeAnalogInputModifier() const;protected
Computes the analog input modifier based on current input vector and/or acceleration.
GetLastUpdateLocation
FVector GetLastUpdateLocation() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Returns the location at the end of the last tick.
GetLastUpdateRotation
FRotator GetLastUpdateRotation() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Returns the rotation at the end of the last tick.
GetLastUpdateQuat
FQuat GetLastUpdateQuat() const;
Returns the rotation Quat at the end of the last tick.
GetLastUpdateVelocity
FVector GetLastUpdateVelocity() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Returns the velocity at the end of the last tick.
GetServerLastTransformUpdateTimeStamp
float GetServerLastTransformUpdateTimeStamp() const;
Get the value of ServerLastTransformUpdateTimeStamp.
GetSimulationTimeStep
float GetSimulationTimeStep(float RemainingTime, int32 Iterations) const;
Compute remaining time step given remaining time and current iterations. The last iteration (limited by MaxSimulationIterations) always returns the remaining time, which may violate MaxSimulationTimeStep.
GetLastServerMovementBase
UPrimitiveComponent* GetLastServerMovementBase() const;
Accessor to the Last Server Movement Base, only relevant during server update
ShouldCorrectRotation
virtual bool ShouldCorrectRotation() const;
Returns if the character rotation should be corrected on clients when sending a server move response correction.
GetLastUpdateRequestedVelocity
FVector GetLastUpdateRequestedVelocity() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Returns velocity requested by path following
SetAvoidanceGroupMask
void SetAvoidanceGroupMask(const FNavAvoidanceMask& GroupMask);UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
virtual void SetAvoidanceGroupMask(int32 GroupFlags) override;
SetGroupsToAvoidMask
void SetGroupsToAvoidMask(const FNavAvoidanceMask& GroupMask);UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
virtual void SetGroupsToAvoidMask(int32 GroupFlags) override;
SetGroupsToIgnoreMask
void SetGroupsToIgnoreMask(const FNavAvoidanceMask& GroupMask);UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
virtual void SetGroupsToIgnoreMask(int32 GroupFlags) override;
SetAvoidanceEnabled
void SetAvoidanceEnabled(bool bEnable);UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Change avoidance state and registers in RVO manager if needed
GetCharacterOwner
ACharacter* GetCharacterOwner() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Get the Character that owns UpdatedComponent.
SetMovementMode
virtual void SetMovementMode(EMovementMode NewMovementMode, uint8 NewCustomMode = 0);UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Change movement mode.
SetGroundMovementMode
void SetGroundMovementMode(EMovementMode NewGroundMovementMode);
Set movement mode to use when returning to walking movement (either MOVE_Walking or MOVE_NavWalking). If movement mode is currently one of Walking or NavWalking, this will also change the current movement mode (via…
GetGroundMovementMode
EMovementMode GetGroundMovementMode() const;
Get current GroundMovementMode value.
OnMovementModeChanged
virtual void OnMovementModeChanged(EMovementMode PreviousMovementMode, uint8 PreviousCustomMode);protected
Called after MovementMode has changed. Base implementation does special handling for starting certain modes, then notifies the CharacterOwner.
PackNetworkMovementMode
virtual uint8 PackNetworkMovementMode() const;
UnpackNetworkMovementMode
virtual void UnpackNetworkMovementMode(const uint8 ReceivedMode, TEnumAsByte<EMovementMode>& OutMode, uint8& OutCustomMode, TEnumAsByte<EMovementMode>& OutGroundMode) const;
ApplyNetworkMovementMode
virtual void ApplyNetworkMovementMode(const uint8 ReceivedMode);
Serialize
virtual void Serialize(FArchive& Archive) override;
Begin UObject Interface
TickComponent
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
End UObject Interface Begin UActorComponent Interface
OnRegister
virtual void OnRegister() override;
BeginDestroy
virtual void BeginDestroy() override;
BeginPlay
virtual void BeginPlay() override;
PostLoad
virtual void PostLoad() override;
Deactivate
virtual void Deactivate() override;
RegisterComponentTickFunctions
virtual void RegisterComponentTickFunctions(bool bRegister) override;
ApplyWorldOffset
virtual void ApplyWorldOffset(const FVector& InOffset, bool bWorldShift) override;
GetMaxSpeed
virtual float GetMaxSpeed() const override;
End UActorComponent Interface BEGIN UMovementComponent Interface
StopActiveMovement
virtual void StopActiveMovement() override;
IsCrouching
virtual bool IsCrouching() const override;
IsFalling
virtual bool IsFalling() const override;
IsMovingOnGround
virtual bool IsMovingOnGround() const override;
IsSwimming
virtual bool IsSwimming() const override;
IsFlying
virtual bool IsFlying() const override;
GetGravityZ
virtual float GetGravityZ() const override;
AddRadialForce
virtual void AddRadialForce(const FVector& Origin, float Radius, float Strength, enum ERadialImpulseFalloff Falloff) override;
AddRadialImpulse
virtual void AddRadialImpulse(const FVector& Origin, float Radius, float Strength, enum ERadialImpulseFalloff Falloff, bool bVelChange) override;
IsWalking
bool IsWalking() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
END UMovementComponent Interface Returns true if the character is in the 'Walking' movement mode.
IsMovementInProgress
bool IsMovementInProgress() const;
Returns true if currently performing a movement update.
GetActorFeetLocation
virtual FVector GetActorFeetLocation() const override;
BEGIN UNavMovementComponent Interface
RequestDirectMove
virtual void RequestDirectMove(const FVector& MoveVelocity, bool bForceMaxSpeed) override;
RequestPathMove
virtual void RequestPathMove(const FVector& MoveInput) override;
CanStartPathFollowing
virtual bool CanStartPathFollowing() const override;
CanStopPathFollowing
virtual bool CanStopPathFollowing() const override;
GetPathFollowingBrakingDistance
virtual float GetPathFollowingBrakingDistance(float MaxSpeed) const override;
NotifyBumpedPawn
virtual void NotifyBumpedPawn(APawn* BumpedPawn) override;
END UNaVMovementComponent Interface Begin UPawnMovementComponent Interface
DisableMovement
virtual void DisableMovement();UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Make movement impossible (sets movement mode to MOVE_None).
HasValidData
virtual bool HasValidData() const;
Return true if we have a valid CharacterOwner and UpdatedComponent.
PerformAirControlForPathFollowing
virtual void PerformAirControlForPathFollowing(FVector Direction, float ZDiff);
If ShouldPerformAirControlForPathFollowing() returns true, it will update Velocity and Acceleration to air control in the desired Direction for character using path following.
ShouldPerformAirControlForPathFollowing
virtual bool ShouldPerformAirControlForPathFollowing() const;
Whether Character should perform air control via PerformAirControlForPathFollowing when falling and following a path at the same time Default implementation always returns true during MOVE_Falling.
StartFalling
virtual void StartFalling(int32 Iterations, float remainingTime, float timeTick, const FVector& Delta, const FVector& subLoc);
Transition from walking to falling
ShouldCatchAir
virtual bool ShouldCatchAir(const FFindFloorResult& OldFloor, const FFindFloorResult& NewFloor);
Whether Character should go into falling mode when walking and changing position, based on an old and new floor result (both of which are considered walkable). Default implementation always returns false.
HandleWalkingOffLedge
virtual void HandleWalkingOffLedge(const FVector& PreviousFloorImpactNormal, const FVector& PreviousFloorContactNormal, const FVector& PreviousLocation, float TimeDelta);
Trigger OnWalkingOffLedge event on CharacterOwner.
AdjustFloorHeight
virtual void AdjustFloorHeight();
Adjust distance from floor, trying to maintain a slight offset from the floor when walking (based on CurrentFloor).
GetMovementBase
UPrimitiveComponent* GetMovementBase() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Return PrimitiveComponent we are based on (standing and walking on).
MaybeUpdateBasedMovement
virtual void MaybeUpdateBasedMovement(float DeltaSeconds);
Update or defer updating of position based on Base movement
UpdateBasedMovement
virtual void UpdateBasedMovement(float DeltaSeconds);
Update position based on Base movement
UpdateBasedRotation
virtual void UpdateBasedRotation(FRotator& FinalRotation, const FRotator& ReducedRotation);
Update controller's view rotation as pawn's base rotates
MaybeSaveBaseLocation
virtual void MaybeSaveBaseLocation();
Call SaveBaseLocation() if not deferring updates (bDeferUpdateBasedMovement is false).
SaveBaseLocation
virtual void SaveBaseLocation();
Update OldBaseLocation and OldBaseQuat if there is a valid movement base, and store the relative location/rotation if necessary. Ignores bDeferUpdateBasedMovement and forces the update.
ApplyImpartedMovementBaseVelocity
virtual void ApplyImpartedMovementBaseVelocity();
Apply inherited velocity when leaving base, for example from jumping off it
StartNewPhysics
virtual void StartNewPhysics(float deltaTime, int32 Iterations);
changes physics based on MovementMode
DoJump
virtual bool DoJump(bool bReplayingMoves, float DeltaTime);
Perform jump. Called by Character when a jump has been detected because Character->bPressedJump was true. Checks Character->CanJump(). Note that you should usually trigger a jump through Character::Jump() instead.
CanAttemptJump
virtual bool CanAttemptJump() const;
Returns true if current movement state allows an attempt at jumping. Used by Character::CanJump().
Launch
virtual void Launch(FVector const& LaunchVel);
Queue a pending launch with velocity LaunchVel.
HandlePendingLaunch
virtual bool HandlePendingLaunch();
Handle a pending launch during an update. Returns true if the launch was triggered.
GetImpartedMovementBaseVelocity
virtual FVector GetImpartedMovementBaseVelocity() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
If we have a movement base, get the velocity that should be imparted by that base, usually when jumping off of it. Only applies the components of the velocity enabled by bImpartBaseVelocityX, bImpartBaseVelocityY,…
JumpOff
virtual void JumpOff(AActor* MovementBaseActor);
Force this pawn to bounce off its current base, which isn't an acceptable base for it.
GetBestDirectionOffActor
virtual FVector GetBestDirectionOffActor(AActor* BaseActor) const;
Can be overridden to choose to jump based on character velocity, base actor dimensions, etc.
ShouldJumpOutOfWater
virtual bool ShouldJumpOutOfWater(FVector& JumpDir);
Calculates the best direction to go to "jump off" an actor.
JumpOutOfWater
virtual void JumpOutOfWater(FVector WallNormal);
Jump onto shore from water
GetDeltaRotation
virtual FRotator GetDeltaRotation(float DeltaTime) const;
Returns how far to rotate character during the time interval DeltaTime.
ComputeOrientToMovementRotation
virtual FRotator ComputeOrientToMovementRotation(const FRotator& CurrentRotation, float DeltaTime, FRotator& DeltaRotation) const;
Compute a target rotation based on current movement. Used by PhysicsRotation() when bOrientRotationToMovement is true. Default implementation targets a rotation based on Acceleration.
ApplyRequestedMove
virtual bool ApplyRequestedMove(float DeltaTime, float MaxAccel, float MaxSpeed, float Friction, float BrakingDeceleration, FVector& OutAcceleration, float& OutRequestedSpeed);
Use velocity requested by path following to compute a requested acceleration and speed. This does not affect the Acceleration member variable, as that is used to indicate input acceleration. This may directly affect…
NotifyJumpApex
virtual void NotifyJumpApex();
Called if bNotifyApex is true and character has just passed the apex of its jump.
NewFallVelocity
virtual FVector NewFallVelocity(const FVector& InitialVelocity, const FVector& Gravity, float DeltaTime) const;
Compute new falling velocity from given velocity and gravity. Applies the limits of the current Physics Volume's TerminalVelocity.
ImmersionDepth
virtual float ImmersionDepth() const;
Determine how deep in water the character is immersed.
CalcVelocity
virtual void CalcVelocity(float DeltaTime, float Friction, bool bFluid, float BrakingDeceleration);UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Updates Velocity and Acceleration based on the current state, applying the effects of friction and acceleration or deceleration. Does not apply gravity. This is used internally during movement updates. Normally you…
GetMaxJumpHeight
virtual float GetMaxJumpHeight() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Compute the max jump height based on the JumpZVelocity velocity and gravity. This does not take into account the CharacterOwner's MaxJumpHoldTime.
GetMaxJumpHeightWithJumpTime
virtual float GetMaxJumpHeightWithJumpTime() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Compute the max jump height based on the JumpZVelocity velocity and gravity. This does take into account the CharacterOwner's MaxJumpHoldTime.
GetMinAnalogSpeed
virtual float GetMinAnalogSpeed() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Returns maximum acceleration for the current state.
GetMaxAcceleration
virtual float GetMaxAcceleration() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Returns maximum acceleration for the current state.
GetMaxBrakingDeceleration
virtual float GetMaxBrakingDeceleration() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Returns maximum deceleration for the current state when braking (ie when there is no acceleration).
GetCurrentAcceleration
FVector GetCurrentAcceleration() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Returns current acceleration, computed from input vector each update.
GetAnalogInputModifier
float GetAnalogInputModifier() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Returns modifier [0..1] based on the magnitude of the last input vector, which is used to modify the acceleration and max speed during movement.
CanStepUp
virtual bool CanStepUp(const FHitResult& Hit) const;
Returns true if we can step up on the actor in the given FHitResult.
StepUp
virtual bool StepUp(const FVector& GravDir, const FVector& Delta, const FHitResult &Hit, FStepDownResult* OutStepDownResult = NULL);
Move up steps or slope. Does nothing and returns false if CanStepUp(Hit) returns false.
SetBase
virtual void SetBase(UPrimitiveComponent* NewBase, const FName BoneName = NAME_None, bool bNotifyActor=true);
Update the base of the character, which is the PrimitiveComponent we are standing on.
SetBaseFromFloor
void SetBaseFromFloor(const FFindFloorResult& FloorResult);
Update the base of the character, using the given floor result if it is walkable, or null if not. Calls SetBase().
ApplyDownwardForce
virtual void ApplyDownwardForce(float DeltaSeconds);
Applies downward force when walking on top of physics objects.
ApplyRepulsionForce
virtual void ApplyRepulsionForce(float DeltaSeconds);
Applies repulsion force to all touched components.
ApplyAccumulatedForces
virtual void ApplyAccumulatedForces(float DeltaSeconds);
Applies momentum accumulated through AddImpulse() and AddForce(), then clears those forces. Does *not* use ClearAccumulatedForces() since that would clear pending launch velocity as well.
ClearAccumulatedForces
virtual void ClearAccumulatedForces();UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Clears forces accumulated through AddImpulse() and AddForce(), and also pending launch velocity.
UpdateCharacterStateBeforeMovement
virtual void UpdateCharacterStateBeforeMovement(float DeltaSeconds);
Update the character state in PerformMovement right before doing the actual position change
UpdateCharacterStateAfterMovement
virtual void UpdateCharacterStateAfterMovement(float DeltaSeconds);
Update the character state in PerformMovement after the position change. Some rotation updates happen after this.
StartSwimming
virtual void StartSwimming(FVector OldLocation, FVector OldVelocity, float timeTick, float remainingTime, int32 Iterations);
Handle start swimming functionality
Swim
float Swim(FVector Delta, FHitResult& Hit);
Swimming uses gravity - but scaled by (1.f - buoyancy)
FindWaterLine
FVector FindWaterLine(FVector Start, FVector End);
Get as close to waterline as possible, staying on same side as currently.
PhysFalling
virtual void PhysFalling(float deltaTime, int32 Iterations);
Handle falling movement.
GetFallingLateralAcceleration
virtual FVector GetFallingLateralAcceleration(float DeltaTime);
Helpers for PhysFalling
ShouldLimitAirControl
virtual bool ShouldLimitAirControl(float DeltaTime, const FVector& FallAcceleration) const;
Returns true if falling movement should limit air control. Limiting air control prevents input acceleration during falling movement from allowing velocity to redirect forces upwards while falling, which could result…
GetAirControl
virtual FVector GetAirControl(float DeltaTime, float TickAirControl, const FVector& FallAcceleration);
Get the air control to use during falling movement. Given an initial air control (TickAirControl), applies the result of BoostAirControl(). This function is used internally by GetFallingLateralAcceleration().
SetGravityDirection
virtual void SetGravityDirection(const FVector& GravityDir);UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Gravity Direction
HasCustomGravity
bool HasCustomGravity() const;UFUNCTIONBlueprintPureCategory=Pawn|Components|CharacterMovement
Whether the gravity direction is different from UCharacterMovementComponent::DefaultGravityDirection.
GetGravityDirection
FVector GetGravityDirection() const;UFUNCTIONBlueprintPureCategory=Pawn|Components|CharacterMovement
Returns the current gravity direction.
GetWorldToGravityTransform
FQuat GetWorldToGravityTransform() const;
Returns a quaternion transforming from world to gravity space.
GetGravityToWorldTransform
FQuat GetGravityToWorldTransform() const;
Returns a quaternion transforming from gravity to world space.
RotateGravityToWorld
FVector RotateGravityToWorld(const FVector& World) const;
Rotate a vector from world to gravity space.
RotateWorldToGravity
FVector RotateWorldToGravity(const FVector& Gravity) const;
Rotate a vector from gravity to world space.
ProjectToGravityFloor
FVector ProjectToGravityFloor(const FVector& Vector) const;
Project a vector onto the floor defined by the gravity direction.
GetGravitySpaceZ
FVector::FReal GetGravitySpaceZ(const FVector& Vector) const;
Returns the size of a vector in the gravity-space vertical direction.
GetGravitySpaceComponentZ
FVector GetGravitySpaceComponentZ(const FVector& Vector) const;
Returns the component of the vector in the gravity-space vertical direction.
SetGravitySpaceZ
void SetGravitySpaceZ(FVector& Vector, const FVector::FReal Z) const;
Set the vertical component of the vector to the given value in the gravity-space vertical direction.
BoostAirControl
virtual float BoostAirControl(float DeltaTime, float TickAirControl, const FVector& FallAcceleration);protected
Increase air control if conditions of AirControlBoostMultiplier and AirControlBoostVelocityThreshold are met. This function is used internally by GetAirControl().
LimitAirControl
virtual FVector LimitAirControl(float DeltaTime, const FVector& FallAcceleration, const FHitResult& HitResult, bool bCheckForValidLandingSpot);protected
Limits the air control to use during falling movement, given an impact while falling. This function is used internally by PhysFalling().
ProcessLanded
virtual void ProcessLanded(const FHitResult& Hit, float remainingTime, int32 Iterations);protected
Handle landing against Hit surface over remaingTime and iterations, calling SetPostLandedPhysics() and starting the new movement mode.
SetPostLandedPhysics
virtual void SetPostLandedPhysics(const FHitResult& Hit);protected
Use new physics after landing. Defaults to swimming if in water, walking otherwise.
ControlledCharacterMove
virtual void ControlledCharacterMove(const FVector& InputVector, float DeltaSeconds);protected
Updates acceleration and perform movement, called from the TickComponent on the authoritative side for controlled characters, or on the client for characters without a controller when either playing root motion or…
SetNavWalkingPhysics
virtual void SetNavWalkingPhysics(bool bEnable);protected
Switch collision settings for NavWalking mode (ignore world collisions)
GetNavData
const class INavigationDataInterface* GetNavData() const;protected
Get Navigation data for the Character. Returns null if there is no associated nav data.
TryToLeaveNavWalking
virtual bool TryToLeaveNavWalking();protected
Checks to see if the current location is not encroaching blocking geometry so the character can leave NavWalking. Restores collision settings and adjusts character location to avoid getting stuck in geometry. If it's…
ProjectLocationFromNavMesh
virtual FVector ProjectLocationFromNavMesh(float DeltaSeconds, const FVector& CurrentFeetLocation, const FVector& TargetNavLocation, float UpOffset, float DownOffset);protected
Attempts to better align navmesh walking characters with underlying geometry (sometimes navmesh can differ quite significantly from geometry). Updates CachedProjectedNavMeshHitResult, access this for more info about…
FindBestNavMeshLocation
virtual void FindBestNavMeshLocation(const FVector& TraceStart, const FVector& TraceEnd, const FVector& CurrentFeetLocation, const FVector& TargetNavLocation, FHitResult& OutHitResult) const;protected
Performs trace for ProjectLocationFromNavMesh
ShouldComputeAccelerationToReachRequestedVelocity
virtual bool ShouldComputeAccelerationToReachRequestedVelocity(const float RequestedSpeed) const;protected
When a character requests a velocity (like when following a path), this method returns true if when we should compute the acceleration toward requested velocity (including friction). If it returns false, it will snap…
OnTeleported
virtual void OnTeleported() override;
Called by owning Character upon successful teleport from AActor::TeleportTo().
Crouch
virtual void Crouch(bool bClientSimulation = false);
Checks if new capsule size fits (no encroachment), and call CharacterOwner->OnStartCrouch() if successful. In general you should set bWantsToCrouch instead to have the crouch persist during movement, or just use the…
UnCrouch
virtual void UnCrouch(bool bClientSimulation = false);
Checks if default capsule size fits (no encroachment), and trigger OnEndCrouch() on the owner if successful.
CanCrouchInCurrentState
virtual bool CanCrouchInCurrentState() const;
Returns true if the character is allowed to crouch in the current state. By default it is allowed when walking or falling, if CanEverCrouch() is true.
SetCrouchedHalfHeight
void SetCrouchedHalfHeight(const float NewValue);UFUNCTION
Sets collision half-height when crouching and updates dependent computations
GetCrouchedHalfHeight
float GetCrouchedHalfHeight() const;UFUNCTION
Returns the collision half-height when crouching (component scale is applied separately)
CheckLedgeDirection
virtual bool CheckLedgeDirection(const FVector& OldLocation, const FVector& SideStep, const FFindFloorResult& OldFloor) const;
Returns true if there is a suitable floor SideStep from current position.
GetLedgeMove
virtual FVector GetLedgeMove(const FVector& OldLocation, const FVector& Delta, const FFindFloorResult& OldFloor) const;
CheckFall
virtual bool CheckFall(const FFindFloorResult& OldFloor, const FHitResult& Hit, const FVector& Delta, const FVector& OldLocation, float remainingTime, float timeTick, int32 Iterations, bool bMustJump);
Check if pawn is falling
RevertMove
void RevertMove(const FVector& OldLocation, UPrimitiveComponent* OldBase, const FVector& InOldBaseLocation, const FFindFloorResult& OldFloor, bool bFailMove);
Revert to previous position OldLocation, return to being based on OldBase. if bFailMove, stop movement and notify controller
PhysicsRotation
virtual void PhysicsRotation(float DeltaTime);
Perform rotation over deltaTime
ShouldRemainVertical
virtual bool ShouldRemainVertical() const;
if true, DesiredRotation will be restricted to only Yaw component in PhysicsRotation()
PhysicsVolumeChanged
virtual void PhysicsVolumeChanged(class APhysicsVolume* NewVolume) override;
Delegate when PhysicsVolume of UpdatedComponent has been changed
SetDefaultMovementMode
virtual void SetDefaultMovementMode();
Set movement mode to the default based on the current physics volume.
MoveSmooth
virtual void MoveSmooth(const FVector& InVelocity, const float DeltaSeconds, FStepDownResult* OutStepDownResult = NULL);
Moves along the given movement direction using simple movement rules based on the current movement mode (usually used by simulated proxies).
UpdateProxyAcceleration
virtual void UpdateProxyAcceleration();
Used during SimulateMovement for proxies, this computes a new value for Acceleration before running proxy simulation. The base implementation simply derives a value from the normalized Velocity value, which may help…
SetUpdatedComponent
virtual void SetUpdatedComponent(USceneComponent* NewUpdatedComponent) override;
GetMovementName
virtual FString GetMovementName() const;
Returns MovementMode string
AddImpulse
virtual void AddImpulse(FVector Impulse, bool bVelocityChange = false);UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Add impulse to character. Impulses are accumulated each tick and applied together so multiple calls to this function will accumulate. An impulse is an instantaneous force, usually applied once. If you want to…
AddForce
virtual void AddForce(FVector Force);UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Add force to character. Forces are accumulated each tick and applied together so multiple calls to this function will accumulate. Forces are scaled depending on timestep, so they can be applied each frame. If you…
DisplayDebug
virtual void DisplayDebug(class UCanvas* Canvas, const FDebugDisplayInfo& DebugDisplay, float& YL, float& YPos);
Draw important variables on canvas. Character will call DisplayDebug() on the current ViewTarget when the ShowDebug exec is used
VisualizeMovement
virtual float VisualizeMovement() const;
Draw in-world debug information for character movement (called with p.VisualizeMovement > 0).
CheckWaterJump
virtual bool CheckWaterJump(FVector CheckPoint, FVector& WallNormal);
Check if swimming pawn just ran into edge of the pool and should jump out.
CanWalkOffLedges
virtual bool CanWalkOffLedges() const;
Returns whether this pawn is currently allowed to walk off ledges
GetPerchRadiusThreshold
float GetPerchRadiusThreshold() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Returns The distance from the edge of the capsule within which we don't allow the character to perch on the edge of a surface.
GetValidPerchRadius
float GetValidPerchRadius() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Returns the radius within which we can stand on the edge of a surface without falling (if this is a walkable surface). Simply computed as the capsule radius minus the result of GetPerchRadiusThreshold().
IsWalkable
virtual bool IsWalkable(const FHitResult& Hit) const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Return true if the hit result should be considered a walkable surface for the character.
GetWalkableFloorAngle
float GetWalkableFloorAngle() const;
Get the max angle in degrees of a walkable surface for the character.
K2_GetWalkableFloorAngle
float K2_GetWalkableFloorAngle() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Get the max angle in degrees of a walkable surface for the character.
SetWalkableFloorAngle
void SetWalkableFloorAngle(float InWalkableFloorAngle);UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Set the max angle in degrees of a walkable surface for the character. Also computes WalkableFloorZ.
GetWalkableFloorZ
float GetWalkableFloorZ() const;
Get the Z component of the normal of the steepest walkable surface for the character. Any lower than this and it is not walkable.
K2_GetWalkableFloorZ
float K2_GetWalkableFloorZ() const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Get the Z component of the normal of the steepest walkable surface for the character. Any lower than this and it is not walkable.
SetWalkableFloorZ
void SetWalkableFloorZ(float InWalkableFloorZ);UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Set the Z component of the normal of the steepest walkable surface for the character. Also computes WalkableFloorAngle.
PrePhysicsTickComponent
virtual void PrePhysicsTickComponent(float DeltaTime, FCharacterMovementComponentPrePhysicsTickFunction& ThisTickFunction);
Tick function called before physics
PostPhysicsTickComponent
virtual void PostPhysicsTickComponent(float DeltaTime, FCharacterMovementComponentPostPhysicsTickFunction& ThisTickFunction);
Tick function called after physics (sync scene) has finished simulation, before cloth
PhysWalking
virtual void PhysWalking(float deltaTime, int32 Iterations);protected
PhysNavWalking
virtual void PhysNavWalking(float deltaTime, int32 Iterations);protected
PhysFlying
virtual void PhysFlying(float deltaTime, int32 Iterations);protected
PhysSwimming
virtual void PhysSwimming(float deltaTime, int32 Iterations);protected
PhysCustom
virtual void PhysCustom(float deltaTime, int32 Iterations);protected
HandleSwimmingWallHit
virtual void HandleSwimmingWallHit(const FHitResult& Hit, float DeltaTime);protected
Allow custom handling when character hits a wall while swimming.
ComputeGroundMovementDelta
virtual FVector ComputeGroundMovementDelta(const FVector& Delta, const FHitResult& RampHit, const bool bHitFromLineTrace) const;protected
Compute a vector of movement, given a delta and a hit result of the surface we are on.
MoveAlongFloor
virtual void MoveAlongFloor(const FVector& InVelocity, float DeltaSeconds, FStepDownResult* OutStepDownResult = NULL);protected
Move along the floor, using CurrentFloor and ComputeGroundMovementDelta() to get a movement direction. If a second walkable surface is hit, it will also be moved along using the same approach.
OnCharacterStuckInGeometry
virtual void OnCharacterStuckInGeometry(const FHitResult* Hit);protected
Notification that the character is stuck in geometry. Only called during walking movement.
MaintainHorizontalGroundVelocity
virtual void MaintainHorizontalGroundVelocity();protected
Adjusts velocity when walking so that Z velocity is zero. When bMaintainHorizontalGroundVelocity is false, also rescales the velocity vector to maintain the original magnitude, but in the horizontal direction.
GetPenetrationAdjustment
virtual FVector GetPenetrationAdjustment(const FHitResult& Hit) const override;protected
Overridden to enforce max distances based on hit geometry.
ResolvePenetrationImpl
virtual bool ResolvePenetrationImpl(const FVector& Adjustment, const FHitResult& Hit, const FQuat& NewRotation) override;protected
Overridden to set bJustTeleported to true, so we don't make incorrect velocity calculations based on adjusted movement.
HandleImpact
virtual void HandleImpact(const FHitResult& Hit, float TimeSlice=0.f, const FVector& MoveDelta = FVector::ZeroVector) override;protected
Handle a blocking impact. Calls ApplyImpactPhysicsForces for the hit, if bEnablePhysicsInteraction is true.
ApplyImpactPhysicsForces
virtual void ApplyImpactPhysicsForces(const FHitResult& Impact, const FVector& ImpactAcceleration, const FVector& ImpactVelocity);protected
Apply physics forces to the impacted component, if bEnablePhysicsInteraction is true.
SlideAlongSurface
virtual float SlideAlongSurface(const FVector& Delta, float Time, const FVector& Normal, FHitResult& Hit, bool bHandleImpact) override;protected
Custom version of SlideAlongSurface that handles different movement modes separately; namely during walking physics we might not want to slide up slopes.
TwoWallAdjust
virtual void TwoWallAdjust(FVector& WorldSpaceDelta, const FHitResult& Hit, const FVector& OldHitNormal) const override;protected
Custom version that allows upwards slides when walking if the surface is walkable.
ComputeSlideVector
virtual FVector ComputeSlideVector(const FVector& Delta, const float Time, const FVector& Normal, const FHitResult& Hit) const override;protected
Calculate slide vector along a surface. Has special treatment when falling, to avoid boosting up slopes (calling HandleSlopeBoosting() in this case).
HandleSlopeBoosting
virtual FVector HandleSlopeBoosting(const FVector& SlideResult, const FVector& Delta, const float Time, const FVector& Normal, const FHitResult& Hit) const;protected
Limit the slide vector when falling if the resulting slide might boost the character faster upwards.
ApplyVelocityBraking
virtual void ApplyVelocityBraking(float DeltaTime, float Friction, float BrakingDeceleration);protected
Slows towards stop.
IsWithinEdgeTolerance
virtual bool IsWithinEdgeTolerance(const FVector& CapsuleLocation, const FVector& TestImpactPoint, const float CapsuleRadius) const;
Return true if the 2D distance to the impact point is inside the edge tolerance (CapsuleRadius minus a small rejection threshold). Useful for rejecting adjacent hits when finding a floor or landing spot.
FindFloor
virtual void FindFloor(const FVector& CapsuleLocation, FFindFloorResult& OutFloorResult, bool bCanUseCachedLocation, const FHitResult* DownwardSweepResult = NULL) const;
Sweeps a vertical trace to find the floor for the capsule at the given location. Will attempt to perch if ShouldComputePerchResult() returns true for the downward sweep result. No floor will be found if collision is…
K2_FindFloor
virtual void K2_FindFloor(FVector CapsuleLocation, FFindFloorResult& FloorResult) const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Sweeps a vertical trace to find the floor for the capsule at the given location. Will attempt to perch if ShouldComputePerchResult() returns true for the downward sweep result. No floor will be found if collision is…
ComputeFloorDist
virtual void ComputeFloorDist(const FVector& CapsuleLocation, float LineDistance, float SweepDistance, FFindFloorResult& OutFloorResult, float SweepRadius, const FHitResult* DownwardSweepResult = NULL) const;
Compute distance to the floor from bottom sphere of capsule and store the result in OutFloorResult. This distance is the swept distance of the capsule to the first point impacted by the lower hemisphere, or distance…
K2_ComputeFloorDist
virtual void K2_ComputeFloorDist(FVector CapsuleLocation, float LineDistance, float SweepDistance, float SweepRadius, FFindFloorResult& FloorResult) const;UFUNCTIONBlueprintCallableCategory=Pawn|Components|CharacterMovement
Compute distance to the floor from bottom sphere of capsule and store the result in FloorResult. This distance is the swept distance of the capsule to the first point impacted by the lower hemisphere, or distance…
FloorSweepTest
virtual bool FloorSweepTest(struct FHitResult& OutHit, const FVector& Start, const FVector& End, ECollisionChannel TraceChannel, const struct FCollisionShape& CollisionShape, const struct FCollisionQueryParams& Params, const struct FCollisionResponseParams& ResponseParam) const;
Sweep against the world and return the first blocking hit. Intended for tests against the floor, because it may change the result of impacts on the lower area of the test (especially if bUseFlatBaseForFloorChecks is…
IsValidLandingSpot
virtual bool IsValidLandingSpot(const FVector& CapsuleLocation, const FHitResult& Hit) const;
Verify that the supplied hit result is a valid landing spot when falling.
ShouldCheckForValidLandingSpot
virtual bool ShouldCheckForValidLandingSpot(float DeltaTime, const FVector& Delta, const FHitResult& Hit) const;
Determine whether we should try to find a valid landing spot after an impact with an invalid one (based on the Hit result). For example, landing on the lower portion of the capsule on the edge of geometry may be a…
ShouldComputePerchResult
virtual bool ShouldComputePerchResult(const FHitResult& InHit, bool bCheckRadius = true) const;
Check if the result of a sweep test (passed in InHit) might be a valid location to perch, in which case we should use ComputePerchResult to validate the location.
ComputePerchResult
virtual bool ComputePerchResult(const float TestRadius, const FHitResult& InHit, const float InMaxFloorDist, FFindFloorResult& OutPerchFloorResult) const;
Compute the sweep result of the smaller capsule with radius specified by GetValidPerchRadius(), and return true if the sweep contacts a valid walkable normal within InMaxFloorDist of InHit.ImpactPoint. This may be…
CapsuleTouched
virtual void CapsuleTouched(UPrimitiveComponent* OverlappedComp, AActor* Other, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);protectedUFUNCTION
Called when the collision capsule touches another primitive component
GetPawnCapsuleExtent
FVector GetPawnCapsuleExtent(const EShrinkCapsuleExtent ShrinkMode, const float CustomShrinkAmount = 0.f) const;protected
Get the capsule extent for the Pawn owner, possibly reduced in size depending on ShrinkMode.
GetPawnCapsuleCollisionShape
FCollisionShape GetPawnCapsuleCollisionShape(const EShrinkCapsuleExtent ShrinkMode, const float CustomShrinkAmount = 0.f) const;protected
Get the collision shape for the Pawn owner, possibly reduced in size depending on ShrinkMode.
AdjustProxyCapsuleSize
virtual void AdjustProxyCapsuleSize();protected
Adjust the size of the capsule on simulated proxies, to avoid overlaps due to replication rounding. Changes to the capsule size on the proxy should set bShrinkProxyCapsule=true and possibly call…
ConstrainInputAcceleration
virtual FVector ConstrainInputAcceleration(const FVector& InputAcceleration) const;protected
Enforce constraints on input given current state. For instance, don't move upwards if walking and looking up.
ScaleInputAcceleration
virtual FVector ScaleInputAcceleration(const FVector& InputAcceleration) const;protected
Scale input acceleration, based on movement acceleration rate.
OnMovementUpdated
virtual void OnMovementUpdated(float DeltaSeconds, const FVector& OldLocation, const FVector& OldVelocity);protected
Event triggered at the end of a movement update. If scoped movement updates are enabled (bEnableScopedMovementUpdates), this is within such a scope. If that is not desired, bind to the CharacterOwner's…
CallMovementUpdateDelegate
virtual void CallMovementUpdateDelegate(float DeltaSeconds, const FVector& OldLocation, const FVector& OldVelocity);protected
Internal function to call OnMovementUpdated delegate on CharacterOwner.
OnUnableToFollowBaseMove
virtual void OnUnableToFollowBaseMove(const FVector& DeltaPosition, const FVector& OldLocation, const FHitResult& MoveOnBaseHit);protected
Event triggered when we are moving on a base but we are not able to move the full DeltaPosition because something has blocked us. Note: MoveComponentFlags includes the flag to ignore the movement base while this…
AccumulateRootMotionForAsync
virtual void AccumulateRootMotionForAsync(float DeltaSeconds, FRootMotionAsyncData& RootMotion);protected
Prepare root motion to be passed on to physics thread
FillAsyncInput
virtual void FillAsyncInput(const FVector& InputVector, FCharacterMovementComponentAsyncInput& AsyncInput);protected
Prepare inputs for asynchronous simulation on physics thread
BuildAsyncInput
virtual void BuildAsyncInput();protected
PostBuildAsyncInput
virtual void PostBuildAsyncInput();protected
ApplyAsyncOutput
virtual void ApplyAsyncOutput(FCharacterMovementComponentAsyncOutput& Output);protected
Apply outputs from async sim.
ProcessAsyncOutput
virtual void ProcessAsyncOutput();protected
RegisterAsyncCallback
virtual void RegisterAsyncCallback();protected
Register async callback with physics system.
IsAsyncCallbackRegistered
virtual bool IsAsyncCallbackRegistered() const;protected
FindNavFloor
virtual bool FindNavFloor(const FVector& TestLocation, FNavLocation& NavFloorLocation) const;
Project a location to navmesh to find adjusted height.
PerformMovement
virtual void PerformMovement(float DeltaTime);protected
Movement functions broken out based on owner's network Role. TickComponent calls the correct version based on the Role. These may be called during move playback and correction during network updates. Perform movement…
SimulatedTick
virtual void SimulatedTick(float DeltaSeconds);protected
Special Tick for Simulated Proxies
SimulateMovement
virtual void SimulateMovement(float DeltaTime);protected
Simulate movement on a non-owning client. Called by SimulatedTick().
ServerAutonomousProxyTick
virtual void ServerAutonomousProxyTick(float DeltaSeconds);protected
Special Tick to allow custom server-side functionality on Autonomous Proxies. Called for all remote APs, including APs controlled on Listen Servers such as the hosting player's Character. If full server-side control…
ForceReplicationUpdate
virtual void ForceReplicationUpdate();
Force a client update by making it appear on the server that the client hasn't updated in a long time.
ForceClientAdjustment
void ForceClientAdjustment();
Force a client adjustment. Resets ServerLastClientAdjustmentTime.
GetNetworkSafeRandomAngleDegrees
virtual float GetNetworkSafeRandomAngleDegrees() const;
Generate a random angle in degrees that is approximately equal between client and server. Note that in networked games this result changes with low frequency and has a low period, so should not be used for frequent…
RoundAcceleration
virtual FVector RoundAcceleration(FVector InAccel) const;
Round acceleration, for better consistency and lower bandwidth in networked games.
SendClientAdjustment
virtual void SendClientAdjustment() override;
INetworkPredictionInterface implementation Server hook
ForcePositionUpdate
virtual bool ForcePositionUpdate(float DeltaTime) override;
SmoothCorrection
virtual void SmoothCorrection(const FVector& OldLocation, const FQuat& OldRotation, const FVector& NewLocation, const FQuat& NewRotation) override;
Client hook
GetPredictionData_Client
virtual class FNetworkPredictionData_Client* GetPredictionData_Client() const override;
Get prediction data for a client game. Should not be used if not running as a client. Allocates the data on demand and can be overridden to allocate a custom override if desired. Result must be a…
GetPredictionData_Server
virtual class FNetworkPredictionData_Server* GetPredictionData_Server() const override;
Get prediction data for a server game. Should not be used if not running as a server. Allocates the data on demand and can be overridden to allocate a custom override if desired. Result must be a…
GetPredictionData_Client_Character
class FNetworkPredictionData_Client_Character* GetPredictionData_Client_Character() const;
GetPredictionData_Server_Character
class FNetworkPredictionData_Server_Character* GetPredictionData_Server_Character() const;
HasPredictionData_Client
virtual bool HasPredictionData_Client() const override;
HasPredictionData_Server
virtual bool HasPredictionData_Server() const override;
ResetPredictionData_Client
virtual void ResetPredictionData_Client() override;
ResetPredictionData_Server
virtual void ResetPredictionData_Server() override;
SmoothClientPosition
virtual void SmoothClientPosition(float DeltaSeconds);protected
Smooth mesh location for network interpolation, based on values set up by SmoothCorrection. Internally this simply calls SmoothClientPosition_Interpolate() then SmoothClientPosition_UpdateVisuals(). This function is…
SmoothClientPosition_Interpolate
void SmoothClientPosition_Interpolate(float DeltaSeconds);protected
Update interpolation values for client smoothing. Does not change actual mesh location. Sets bNetworkSmoothingComplete to true when the interpolation reaches the target.
SmoothClientPosition_UpdateVisuals
void SmoothClientPosition_UpdateVisuals();protected
Update mesh location based on interpolated values.
ReplicateMoveToServer
virtual void ReplicateMoveToServer(float DeltaTime, const FVector& NewAcceleration);protected
======================================================================== Here's how player movement prediction, replication and correction works in network games:
ClientUpdatePositionAfterServerUpdate
virtual bool ClientUpdatePositionAfterServerUpdate();protected
If bUpdatePosition is true, then replay any unacked moves. Returns whether any moves were actually replayed.
CallServerMovePacked
virtual void CallServerMovePacked(const FSavedMove_Character* NewMove, const FSavedMove_Character* PendingMove, const FSavedMove_Character* OldMove);protected
On the client, calls the ServerMovePacked_ClientSend() function with packed movement data. First the FCharacterNetworkMoveDataContainer from GetNetworkMoveDataContainer() is updated with ClientFillNetworkMoveData(),…
ServerCheckClientError
virtual bool ServerCheckClientError(float ClientTimeStamp, float DeltaTime, const FVector& Accel, const FVector& ClientWorldLocation, const FVector& RelativeClientLocation, UPrimitiveComponent* ClientMovementBase, FName ClientBaseBoneName, uint8 ClientMovementMode);protected
Check for Server-Client disagreement in position or other movement state important enough to trigger a client correction.
ServerExceedsAllowablePositionError
virtual bool ServerExceedsAllowablePositionError(float ClientTimeStamp, float DeltaTime, const FVector& Accel, const FVector& ClientWorldLocation, const FVector& RelativeClientLocation, UPrimitiveComponent* ClientMovementBase, FName ClientBaseBoneName, uint8 ClientMovementMode);protected
Check position error within ServerCheckClientError(). Set bNetworkLargeClientCorrection to true if the correction should be prioritized (delayed less in SendClientAdjustment).
ServerShouldUseAuthoritativePosition
virtual bool ServerShouldUseAuthoritativePosition(float ClientTimeStamp, float DeltaTime, const FVector& Accel, const FVector& ClientWorldLocation, const FVector& RelativeClientLocation, UPrimitiveComponent* ClientMovementBase, FName ClientBaseBoneName, uint8 ClientMovementMode);protected
If ServerCheckClientError() does not find an error, this determines if the server should also copy the client's movement params rather than keep the server sim result.
MoveAutonomous
virtual void MoveAutonomous(float ClientTimeStamp, float DeltaTime, uint8 CompressedFlags, const FVector& NewAccel);protected
Process a move at the given time stamp, given the compressed flags representing various events that occurred (ie jump).
UpdateFromCompressedFlags
virtual void UpdateFromCompressedFlags(uint8 Flags);protected
Unpack compressed flags from a saved move and set state accordingly. See FSavedMove_Character.
CanDelaySendingMove
virtual bool CanDelaySendingMove(const FSavedMovePtr& NewMove);protected
Return true if it is OK to delay sending this player movement to the server, in order to conserve bandwidth.
GetClientNetSendDeltaTime
virtual float GetClientNetSendDeltaTime(const APlayerController* PC, const FNetworkPredictionData_Client_Character* ClientData, const FSavedMovePtr& NewMove) const;protected
Determine minimum delay between sending client updates to the server. If updates occur more frequently this than this time, moves may be combined delayed.
TickCharacterPose
virtual void TickCharacterPose(float DeltaTime);protected
Ticks the characters pose and accumulates root motion
ShouldCancelAdaptiveReplication
virtual bool ShouldCancelAdaptiveReplication() const;protected
On the server if we know we are having our replication rate throttled, this method checks if important replicated properties have changed that should cause us to return to the normal replication rate.
UpdateFloorFromAdjustment
virtual void UpdateFloorFromAdjustment();
React to instantaneous change in position. Invalidates cached floor recomputes it if possible if there is a current movement base.
VerifyClientTimeStamp
virtual bool VerifyClientTimeStamp(float TimeStamp, FNetworkPredictionData_Server_Character & ServerData);
On the Server, verify that an incoming client TimeStamp is valid and has not yet expired. It will also handle TimeStamp resets if it detects a gap larger than MinTimeBetweenTimeStampResets / 2.f !!…
IsClientTimeStampValid
bool IsClientTimeStampValid(float TimeStamp, const FNetworkPredictionData_Server_Character& ServerData, bool& bTimeStampResetDetected) const;protected
Internal const check for client timestamp validity without side-effects.
OnClientTimeStampResetDetected
virtual void OnClientTimeStampResetDetected();protected
Called by UCharacterMovementComponent::VerifyClientTimeStamp() when a client timestamp reset has been detected and is valid.
ProcessClientTimeStampForTimeDiscrepancy
virtual void ProcessClientTimeStampForTimeDiscrepancy(float ClientTimeStamp, FNetworkPredictionData_Server_Character& ServerData);protected
Processes client timestamps from ServerMoves, detects and protects against time discrepancy between client-reported times and server time Called by UCharacterMovementComponent::VerifyClientTimeStamp() for valid…
OnTimeDiscrepancyDetected
virtual void OnTimeDiscrepancyDetected(float CurrentTimeDiscrepancy, float LifetimeRawTimeDiscrepancy, float Lifetime, float CurrentMoveError);protected
Called by UCharacterMovementComponent::ProcessClientTimeStampForTimeDiscrepancy() (on server) when the time from client moves significantly differs from the server time, indicating potential time manipulation by…
ShouldUsePackedMovementRPCs
virtual bool ShouldUsePackedMovementRPCs() const;
Determines whether to use packed movement RPCs with variable length payloads, or legacy code which has multiple functions required for different situations. The default implementation checks the console variable…
MoveResponsePacked_ServerSend
void MoveResponsePacked_ServerSend(const FCharacterMoveResponsePackedBits& PackedBits);
Sends a move response from the server to the client (through character to avoid component RPC overhead), eventually calling MoveResponsePacked_ClientReceive() on the client.
MoveResponsePacked_ClientReceive
void MoveResponsePacked_ClientReceive(const FCharacterMoveResponsePackedBits& PackedBits);
On the client, receives a packed move response from the server, unpacks it by serializing into the MoveResponseContainer from GetMoveResponseDataContainer(), and passes the data container to ClientHandleMoveResponse().
ServerSendMoveResponse
void ServerSendMoveResponse(const FClientAdjustment& PendingAdjustment);
On the server, sends a packed move response to the client. First the FCharacterMoveResponseDataContainer from GetMoveResponseDataContainer() is filled in with ServerFillResponseData(). Then this data is serialized to…
ClientHandleMoveResponse
virtual void ClientHandleMoveResponse(const FCharacterMoveResponseDataContainer& MoveResponse);
On the client, handles the move response from the server after it has been received and unpacked in MoveResponsePacked_ClientReceive. Based on the data in the response, dispatches a call to…
OnClientCorrectionReceived
virtual void OnClientCorrectionReceived(class FNetworkPredictionData_Client_Character& ClientData, float TimeStamp, FVector NewLocation, FVector NewVelocity, UPrimitiveComponent* NewBase, FName NewBaseBoneName, bool bHasBase, bool bBaseRelativePosition, uint8 ServerMovementMode, FVector ServerGravityDirection);protected
Event notification when client receives correction data from the server, before applying the data. Base implementation logs relevant data and draws debug info if "p.NetShowCorrections" is not equal to 0.
SetNetworkMoveDataContainer
void SetNetworkMoveDataContainer(FCharacterNetworkMoveDataContainer& PersistentDataStorage);protected
Set custom struct used for client to server move RPC serialization. This is typically set in the constructor for this component and should persist for the lifetime of the component.
GetNetworkMoveDataContainer
FCharacterNetworkMoveDataContainer& GetNetworkMoveDataContainer() const;protected
Get the struct used for client to server move RPC serialization.
GetCurrentNetworkMoveData
FCharacterNetworkMoveData* GetCurrentNetworkMoveData() const;protected
Current move data being processed or handled. This is set before MoveAutonomous (for replayed moves and server moves), and cleared thereafter. Useful for being able to access custom movement data during internal…
SetCurrentNetworkMoveData
void SetCurrentNetworkMoveData(FCharacterNetworkMoveData* CurrentData);protected
Used internally to set the FCharacterNetworkMoveData currently being processed, either being serialized or replayed on the client, or being received and processed on the server.
SetMoveResponseDataContainer
void SetMoveResponseDataContainer(FCharacterMoveResponseDataContainer& PersistentDataStorage);protected
Set custom struct used for server response RPC serialization. This is typically set in the constructor for this component and should persist for the lifetime of the component.
GetMoveResponseDataContainer
FCharacterMoveResponseDataContainer& GetMoveResponseDataContainer() const;protected
Get the struct used for server response RPC serialization.
SetCurrentReplayedSavedMove
void SetCurrentReplayedSavedMove(FSavedMove_Character* SavedMove);protected
Used internally to save the SavedMove currently being replayed on the client so it is accessible to any functions that might need it. @see: ClientUpdatePositionAfterServerUpdate
GetCurrentReplayedSavedMove
const FSavedMove_Character* GetCurrentReplayedSavedMove() const;
Gets the SavedMove being replayed on the client after a correction is received. @see: ClientUpdatePositionAfterServerUpdate
HasRootMotionSources
bool HasRootMotionSources() const;
Returns true if we have Root Motion from any source to use in PerformMovement() physics.
ApplyRootMotionSource
uint16 ApplyRootMotionSource(TSharedPtr<FRootMotionSource> SourcePtr);
Apply a RootMotionSource to current root motion
OnRootMotionSourceBeingApplied
virtual void OnRootMotionSourceBeingApplied(const FRootMotionSource* Source);
Called during ApplyRootMotionSource call, useful for project-specific alerts for "something is about to be altering our movement"
GetRootMotionSource
TSharedPtr<FRootMotionSource> GetRootMotionSource(FName InstanceName);
Get a RootMotionSource from current root motion by name
GetRootMotionSourceByID
TSharedPtr<FRootMotionSource> GetRootMotionSourceByID(uint16 RootMotionSourceID);
Get a RootMotionSource from current root motion by ID
RemoveRootMotionSource
void RemoveRootMotionSource(FName InstanceName);
Remove a RootMotionSource from current root motion by name
RemoveRootMotionSourceByID
void RemoveRootMotionSourceByID(uint16 RootMotionSourceID);
Remove a RootMotionSource from current root motion by ID
ConvertRootMotionServerIDsToLocalIDs
void ConvertRootMotionServerIDsToLocalIDs(const FRootMotionSourceGroup& LocalRootMotionToMatchWith, FRootMotionSourceGroup& InOutServerRootMotion, float TimeStamp);
Converts received server IDs in a root motion group to local IDs
RestorePreAdditiveRootMotionVelocity
virtual void RestorePreAdditiveRootMotionVelocity();protected
Restores Velocity to LastPreAdditiveVelocity during Root Motion Phys*() function calls
ApplyRootMotionToVelocity
virtual void ApplyRootMotionToVelocity(float deltaTime);protected
Applies root motion from root motion sources to velocity (override and additive)
DecayFormerBaseVelocity
void DecayFormerBaseVelocity(float deltaTime);protected
Reduces former base velocity according to FormerBaseVelocityDecayHalfLife
HasAnimRootMotion
bool HasAnimRootMotion() const;
Returns true if we have Root Motion from animation to use in PerformMovement() physics. Not valid outside of the scope of that function. Since RootMotion is extracted and used in it.
ConvertLocalRootMotionToWorld
FTransform ConvertLocalRootMotionToWorld(const FTransform& InLocalRootMotion, float DeltaSeconds);
Takes component space root motion and converts it to world space
SimulateRootMotion
void SimulateRootMotion(float DeltaSeconds, const FTransform& LocalRootMotionTransform);
Simulate Root Motion physics on Simulated Proxies
CalcAnimRootMotionVelocity
virtual FVector CalcAnimRootMotionVelocity(const FVector& RootMotionDeltaMove, float DeltaSeconds, const FVector& CurrentVelocity) const;
Calculate velocity from anim root motion.
ConstrainAnimRootMotionVelocity
virtual FVector ConstrainAnimRootMotionVelocity(const FVector& RootMotionVelocity, const FVector& CurrentVelocity) const;
Constrain components of root motion velocity that may not be appropriate given the current movement mode (e.g. when falling Z may be ignored).
CalcAvoidanceVelocity
virtual void CalcAvoidanceVelocity(float DeltaTime);
RVO Avoidance calculate RVO avoidance and apply it to current velocity
PostProcessAvoidanceVelocity
virtual void PostProcessAvoidanceVelocity(FVector& NewVelocity);
allows modifing avoidance velocity, called when bUseRVOPostProcess is set
FlushServerMoves
virtual void FlushServerMoves();
GetTeleportType
ETeleportType GetTeleportType() const;
When moving the character, we should inform physics as to whether we are teleporting. This allows physics to avoid injecting forces into simulations from client corrections (etc.)
UpdateDefaultAvoidance
void UpdateDefaultAvoidance();protected
called in Tick to update data in RVO avoidance manager
SetAvoidanceVelocityLock
void SetAvoidanceVelocityLock(class UAvoidanceManager* Avoidance, float Duration);
lock avoidance velocity
SetRVOAvoidanceUID
virtual void SetRVOAvoidanceUID(int32 UID) override;
BEGIN IRVOAvoidanceInterface
GetRVOAvoidanceUID
virtual int32 GetRVOAvoidanceUID() override;
SetRVOAvoidanceWeight
virtual void SetRVOAvoidanceWeight(float Weight) override;
GetRVOAvoidanceWeight
virtual float GetRVOAvoidanceWeight() override;
GetRVOAvoidanceOrigin
virtual FVector GetRVOAvoidanceOrigin() override;
GetRVOAvoidanceRadius
virtual float GetRVOAvoidanceRadius() override;
GetRVOAvoidanceHeight
virtual float GetRVOAvoidanceHeight() override;
GetRVOAvoidanceConsiderationRadius
virtual float GetRVOAvoidanceConsiderationRadius() override;
GetVelocityForRVOConsideration
virtual FVector GetVelocityForRVOConsideration() override;
GetAvoidanceGroupMask
virtual int32 GetAvoidanceGroupMask() override;
GetGroupsToAvoidMask
virtual int32 GetGroupsToAvoidMask() override;
GetGroupsToIgnoreMask
virtual int32 GetGroupsToIgnoreMask() override;
GetRVOAvoidanceUIDFast
int32 GetRVOAvoidanceUIDFast() const;
END IRVOAvoidanceInterface a shortcut function to be called instead of GetRVOAvoidanceUID when callee knows it's dealing with a char movement comp

Static functions 2

AddReferencedObjects
static void AddReferencedObjects(UObject* InThis, FReferenceCollector& Collector);
PackYawAndPitchTo32
static uint32 PackYawAndPitchTo32(const float Yaw, const float Pitch);

Functions

Free functions 5

DECLARE_DELEGATE_RetVal_ThreeParams
DECLARE_DELEGATE_RetVal_ThreeParams(FTransform, FOnProcessRootMotion, const FTransform&, UCharacterMovementComponent*, float) namespace CharacterMovementConstants;
GetCharacterOwner
ACharacter* UCharacterMovementComponent::GetCharacterOwner() const;
IsWalking
bool UCharacterMovementComponent::IsWalking() const;
PackYawAndPitchTo32
uint32 UCharacterMovementComponent::PackYawAndPitchTo32(const float Yaw, const float Pitch);
FSavedMove_Character
UE_DEPRECATED_FORGAME(4.20)