UCharacterMovementComponent::CheckLedgeDirection
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtualconst
Description
Tests whether stepping sideways by SideStep from OldLocation lands on a walkable floor, used to decide whether the character can slide along a ledge instead of falling off it.
Caveats & Gotchas
- • Called internally by GetLedgeMove()/CheckFall() as part of ledge-handling logic — it doesn't move the character itself, it only reports whether a sidestep would be safe.
- • Uses a floor sweep at the sidestepped location, so it has the same cost and caveats as FindFloor() (collision must be enabled on the capsule for it to find anything).
- • Returning true does not guarantee the character will actually take that path; it's one of several checks combined in the ledge-fall decision.
Signature
virtual bool CheckLedgeDirection(const FVector& OldLocation, const FVector& SideStep, const FFindFloorResult& OldFloor) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| OldLocation | const FVector& | Location before the move that put the character over a ledge. | — |
| SideStep | const FVector& | Sideways step direction/distance to test for a suitable floor. | — |
| OldFloor | const FFindFloorResult& | Floor result from before the move that went over the ledge. | — |
Return Type
bool Example
Overriding to disable ledge sliding entirely C++
bool UMyCharacterMovementComponent::CheckLedgeDirection(const FVector& OldLocation, const FVector& SideStep, const FFindFloorResult& OldFloor) const
{
// Always report no safe sidestep, forcing characters to fall off every ledge.
return false;
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?