UCharacterMovementComponent::ShouldComputePerchResult
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtual
Description
Checks whether a sweep hit might represent a valid perch location, such that ComputePerchResult() should be called to validate it further.
Caveats & Gotchas
- • Returns false outright if GetPerchRadiusThreshold() is smaller than the internal edge-rejection distance — setting PerchRadiusThreshold too small silently disables perching entirely instead of erroring.
- • With bCheckRadius true (the default), it also returns false when the impact point is already within the valid perch radius, since no perch adjustment is needed in that case.
Signature
virtual bool ShouldComputePerchResult(const FHitResult& InHit, bool bCheckRadius = true) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InHit | const FHitResult& | Result of the last sweep test before this query. | — |
| bCheckRadius | bool | If true, only allow the perch test when the impact point is outside the radius returned by GetValidPerchRadius(). | true |
Return Type
bool Example
Gate a perch check on a sweep hit C++
if (ShouldComputePerchResult(DownwardSweepHit))
{
FFindFloorResult PerchFloorResult;
const bool bCanPerch = ComputePerchResult(GetValidPerchRadius(), DownwardSweepHit, MaxStepHeight, PerchFloorResult);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?