UCharacterMovementComponent::FindFloor
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtual
Description
Sweeps a vertical trace to find the floor beneath the capsule at the given location, and attempts to perch at the edge of unwalkable surfaces when ShouldComputePerchResult() allows it. No floor is found if the capsule's collision is disabled.
Caveats & Gotchas
- • No floor will be found at all if collision is disabled on the capsule component, per the header's own warning comment.
- • bCanUseCachedLocation only takes effect when the character has a movement base with blocking collision that isn't a dynamic base; otherwise the function silently forces a fresh sweep regardless of the flag.
Signature
virtual void FindFloor(const FVector& CapsuleLocation, FFindFloorResult& OutFloorResult, bool bCanUseCachedLocation, const FHitResult* DownwardSweepResult = NULL) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| CapsuleLocation | const FVector& | Location where the capsule sweep should originate. | — |
| OutFloorResult | FFindFloorResult& | Out parameter that receives the result of the floor check. | — |
| bCanUseCachedLocation | bool | If true, may reuse a cached floor result instead of sweeping again, when it's safe to do so. | — |
| DownwardSweepResult | const FHitResult* | If non-null with a valid blocking hit, used as the result of the downward sweep instead of performing one. | NULL |
Return Type
void Example
Query the floor beneath a custom capsule location C++
FFindFloorResult FloorResult;
GetCharacterMovement()->FindFloor(GetActorLocation(), FloorResult, false);
if (FloorResult.IsWalkableFloor())
{
// Safe to stand here.
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?