FindPathSync not considering actor height

Hello everyone, I’m having a bit of trouble at implementing my own movement system for a simple RTS game.
As I’d like to obtain large amount of actors controlled by AI/Player, using the ACharacter class I get awful performances due to the high (and unecessary for my purposes) complexity. So I decided to go with a custom character class with only the functionalities I really need.

I’m implementing a SearchPath function which takes as input the destination vector and a reference to the output array of path points.
Overall the code works, as it outputs a reasonable set of points to be followed.
However, I cannot figure out:

  • Why the FindPathSync() method does not seem to take into consideration the ActorHeight and ActorRadius I set in the FNavAgentProperties. (i.e. I always get points that do not have the Z coordinate adjusted depending on the mentioned parameters).
  • Why am I getting all points to be +10 in Z (e.g. If my destination point is (x,y,z) I get the last point to be (x,y,z+10).

Here’s the mentioned code:

bool AStrategyAIController::SearchPath(const FVector& Destination, TArray<FVector> & OutPathPoints) const
{
	// Build query for navigation system
	FPathFindingQuery Query;
	
	FAIMoveRequest MoveRequest;
	MoveRequest.SetAcceptanceRadius(3.f);
	MoveRequest.SetGoalLocation(Destination);	
	
	const bool bValidQuery = BuildPathfindingQuery(MoveRequest, Query);

	// Get navigation system and initialize result/agent properties
	UWorld* World = GetWorld();
	if (World == nullptr) return false;
	UNavigationSystemV1* NavSys = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld());
	
	FNavAgentProperties navAgentProperties;
	navAgentProperties.AgentHeight = SelectablePawn->GetCapsuleComponent()->GetScaledCapsuleHalfHeight() * 2;
	navAgentProperties.AgentRadius = SelectablePawn->GetCapsuleComponent()->GetScaledCapsuleRadius();
	
	FPathFindingResult PathFindingResult;

	// Calculate path synchronously and populate array of points
	if (NavSys != nullptr)
	{
		PathFindingResult = NavSys->FindPathSync(navAgentProperties, Query);

		if (PathFindingResult.Result != ENavigationQueryResult::Error)
		{
			if (PathFindingResult.IsSuccessful() && PathFindingResult.Path.IsValid())
			{

				for(FNavPathPoint point : PathFindingResult.Path->GetPathPoints())

				{

					OutPathPoints.Add(point.Location);

				}

			}
		}
	}
	
	return true;
}

I’m surely missing something here, therefore I kindly ask for your help.

Update: I Figured out that the answer to the second question (the +10 offset in Z coordinate) has something to do with the Cell height inside project properties.

Still, I can’t figure out how to make the pathfinding to consider agent’s height.
As for now, I am correcting the Z coordinate “manually” once I get the path points, but still I think it should be done automatically since FindPathSync() requires that information as input.