RealDocs

UCharacterMovementComponent::AdjustFloorHeight

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

Description

Nudges the character vertically to maintain a small offset above the current floor (CurrentFloor) after a walking move, keeping the capsule from resting exactly on or penetrating the floor.

Caveats & Gotchas

  • Does nothing if CurrentFloor.IsWalkableFloor() is false — it only adjusts height when there's a valid walkable floor result to adjust toward.
  • Aborts without adjusting if the floor result came from a line trace with a small floor distance while the sweep distance was already at least MIN_FLOOR_DIST, since applying the adjustment in that case could scale an unwalkable wall.
  • Called internally at the end of PhysWalking each iteration; calling it manually outside that context relies on CurrentFloor already being up to date from a prior floor check.

Signature

virtual void AdjustFloorHeight()

Return Type

void

Example

Reacting to floor height adjustments C++
void UMyCharacterMovementComponent::AdjustFloorHeight()
{
    Super::AdjustFloorHeight();
    OnFloorHeightAdjusted.Broadcast(CurrentFloor.FloorDist);
}

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.