ACharacter::OnWalkingOffLedge
#include "GameFramework/Character.h"
Access: public
Specifiers: UFUNCTIONBlueprintNativeEvent
Description
Fired when the character is walking and the floor becomes unwalkable, just before falling begins. Override to apply custom launch velocities or trigger effects at the moment of stepping off a ledge.
Caveats & Gotchas
- • The character's Z velocity is zero during walking movement and will also be zero here — if you want to launch the character sideways off the ledge, set Velocity in CharacterMovement before this returns.
- • If you change CharacterMovement->MovementMode inside this event to something other than Falling, the engine will not automatically start the fall — the override takes effect instead.
- • This is a BlueprintNativeEvent: C++ overrides must be placed in OnWalkingOffLedge_Implementation, not OnWalkingOffLedge itself.
Signature
ENGINE_API void OnWalkingOffLedge(const FVector& PreviousFloorImpactNormal, const FVector& PreviousFloorContactNormal, const FVector& PreviousLocation, float TimeDelta) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| PreviousFloorImpactNormal | const FVector& | Normal of the walkable floor surface just before the character left it. | — |
| PreviousFloorContactNormal | const FVector& | Normal of the contact point with the previous floor. | — |
| PreviousLocation | const FVector& | Character world location just before the movement update that resulted in leaving the ledge. | — |
| TimeDelta | float | Duration of the movement tick that caused the character to walk off the ledge. | — |
Return Type
void Example
Add a small outward kick when walking off a ledge C++
void AMyCharacter::OnWalkingOffLedge_Implementation(
const FVector& PrevImpactNormal, const FVector& PrevContactNormal,
const FVector& PrevLocation, float TimeDelta)
{
Super::OnWalkingOffLedge_Implementation(PrevImpactNormal, PrevContactNormal, PrevLocation, TimeDelta);
// Add a small outward impulse based on the previous floor normal
FVector LedgeKick = PrevImpactNormal * 100.f;
LedgeKick.Z = 0.f;
GetCharacterMovement()->Velocity += LedgeKick;
} Tags
Version History
Introduced in: 4.8
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?