RealDocs

UCharacterMovementComponent::CheckFall

function Engine Since 4.0
#include "GameFramework/CharacterMovementComponent.h"
Access: public Specifiers: virtual

Description

Determines whether the character should start falling after losing its footing, and if so calls HandleWalkingOffLedge() and transitions it into the Falling movement mode.

Caveats & Gotchas

  • • Only triggers a fall when bMustJump is true or CanWalkOffLedges() returns true; if both are false, the function returns false and the character is instead blocked at the ledge.
  • • This is an internal step of the walking movement pipeline called from PhysWalking(); it doesn't revert the character's position itself — callers are expected to call RevertMove() first if the fall shouldn't be committed.

Signature

virtual bool CheckFall(const FFindFloorResult& OldFloor, const FHitResult& Hit, const FVector& Delta, const FVector& OldLocation, float remainingTime, float timeTick, int32 Iterations, bool bMustJump)

Parameters

Name Type Description Default
OldFloor const FFindFloorResult& Floor result from before the move that triggered this check. —
Hit const FHitResult& Hit result from the move that may have gone over a ledge. —
Delta const FVector& The move delta that was being applied. —
OldLocation const FVector& Location before the move. —
remainingTime float Time remaining in the current movement substep. —
timeTick float Duration of the current movement substep. —
Iterations int32 Current physics iteration count. —
bMustJump bool If true, forces the character to fall off the ledge regardless of CanWalkOffLedges(). —

Return Type

bool

Example

Handle a walking hit that goes over a ledge C++
if (!CheckLedgeDirection(OldLocation, SideStep, OldFloor))
{
	const bool bMustJump = bJustTeleported || IsMovingOnGround();
	if (CheckFall(OldFloor, Hit, Delta, OldLocation, remainingTime, timeTick, Iterations, bMustJump))
	{
		return;
	}
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable —

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.