RealDocs

ACharacter::GetNavAgentLocation

function Engine Since 4.0
#include "GameFramework/Character.h"
Access: public Specifiers: virtualoverride

Description

Returns the world-space location used by the navigation system to represent this character's position. ACharacter returns the capsule base location rather than the actor pivot to keep nav queries grounded.

Caveats & Gotchas

  • The returned point is at the bottom of the capsule, not the actor origin — this matches where the navmesh samples the agent. Comparing this value with GetActorLocation() will give a difference equal to half the capsule half-height.
  • If the character has no CapsuleComponent (rare custom setups), this falls back to GetActorLocation().

Signature

virtual FVector GetNavAgentLocation() const override

Return Type

FVector

Example

Feed nav location to a path query C++
FVector AgentPos = GetNavAgentLocation();
UNavigationSystemV1* NavSys = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld());
FNavLocation ResultLoc;
NavSys->GetRandomReachablePointInRadius(AgentPos, 500.f, ResultLoc);

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.