UCharacterMovementComponent::FindNavFloor
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtualconst
Description
Projects TestLocation onto the navmesh to find the corresponding navmesh floor height, used for NavWalking movement mode.
Caveats & Gotchas
- • Returns true if a projection attempt was performed, not necessarily that it succeeded in finding a valid navmesh point — check NavFloorLocation's validity separately, or rely on the caller's downstream handling.
- • Only relevant when MovementMode is MOVE_NavWalking; irrelevant for normal MOVE_Walking, which uses physical floor sweeps via FindFloor() instead.
- • Requires a navigation system and generated navmesh present in the world; in editor previews or worlds with no NavMeshBoundsVolume this will not find a floor.
Signature
virtual bool FindNavFloor(const FVector& TestLocation, FNavLocation& NavFloorLocation) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| TestLocation | const FVector& | World-space location to project onto the navmesh. | — |
| NavFloorLocation | FNavLocation& | Out parameter receiving the resulting location on the navmesh, if found. | — |
Return Type
bool Example
Manually projecting a location onto the navmesh C++
bool UMyCharacterMovementComponent::TryProjectOntoNav(const FVector& Location, FVector& OutFloorLocation)
{
FNavLocation NavLoc;
if (FindNavFloor(Location, NavLoc))
{
OutFloorLocation = NavLoc.Location;
return true;
}
return false;
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?