UCharacterMovementComponent::IsWalkable
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallablevirtual
Description
Returns true if the hit result should be considered a walkable surface for the character, based on the impact normal's angle relative to WalkableFloorZ.
Caveats & Gotchas
- • Returns false immediately for hits that aren't a valid blocking hit, including hits where the trace started in penetration.
- • The slope check uses GetGravitySpaceZ(Hit.ImpactNormal) rather than the raw world-space Z component, so it respects a custom gravity direction set via SetGravityDirection() instead of assuming 'up' is always +Z.
- • Called frequently during floor-finding, so overrides that add expensive logic (trace, physical material lookups) can noticeably affect movement performance.
Signature
virtual bool IsWalkable(const FHitResult& Hit) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Hit | const FHitResult& | Hit result to test against the walkable floor angle. | — |
Return Type
bool Example
Reject icy surfaces as walkable C++
bool UMyMovementComponent::IsWalkable(const FHitResult& Hit) const
{
if (Hit.PhysMaterial.IsValid() && Hit.PhysMaterial->SurfaceType == SurfaceType_Ice)
{
return false;
}
return Super::IsWalkable(Hit);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?