How to read current NavArea in which character is?

Hei,

Thanks for your code, it contributed to my game. I’m pasting my code because I spent a few minutes adapting it to Unreal 4.15.

#include "Runtime/Engine/Classes/AI/Navigation/NavigationSystem.h"
#include "Runtime/Engine/Classes/AI/Navigation/RecastNavMesh.h"

int32 AMyCharacter::GetNearestPolyAreaID()
{
	auto world = GetWorld();
	if (!world) return 0;

	auto navSystem = world->GetNavigationSystem();
	if (!navSystem) return 0;

	auto navData = navSystem->GetMainNavData(FNavigationSystem::DontCreate);
	if (!navData) return 0;

	const ARecastNavMesh * navMesh = Cast<ARecastNavMesh>(navData);
	if (!navMesh) return 0;

	auto loc = GetActorLocation();
	auto extent = FVector(100.0f, 100.0f, 100.0f);
	NavNodeRef poly = navMesh->FindNearestPoly(loc, extent, navData->GetDefaultQueryFilter());

	auto areaID = navMesh->GetPolyAreaID(poly);

	return areaID;
}