Download

How to Export Navmesh to use in RecastDemo?

hi.
I want to use navmesh data for server.
so i export navmesh data to .obj file.
but I can not be sure of below code.
Anyone let me know if you know how to export navmesh to obj file.

anyway .obj data loaded suceess in recastDemo.
but loaded obj file is so big.
unreal editor unit setting is centimeter.
i dont know recastDemo unit setting…

it is very strange…
unreal editor navmesh setting max value is 1024.
but recastDemo max value is 1.

maybe… unreal and recastDemo unit setting is different?


UNavMeshRenderingComponent* renderingComponent = Cast<UNavMeshRenderingComponent>(NavData->ConstructRenderingComponent());

FNavMeshSceneProxyData ProxyData;
const int32 DetailFlags = ProxyData.GetDetailFlags(NavData);
TArray<int32> EmptyTileSet;
ProxyData.GatherData(NavData, DetailFlags, EmptyTileSet);

//FNavMeshSceneProxy* NavMeshSceneProxy = new FNavMeshSceneProxy(renderingComponent, &ProxyData);
const int32 NumberOfMeshes = ProxyData.MeshBuilders.Num();
if (NumberOfMeshes)
{
for (int32 Index = 0; Index < NumberOfMeshes; ++Index)
{
const auto& CurrentMeshBuilder = ProxyData.MeshBuilders[Index];

for (int v = 0; v < CurrentMeshBuilder.Vertices.Num(); ++v)
{

FVector convertPosition = Unreal2RecastPoint(CurrentMeshBuilder.Vertices[v].Position);

CoordBuffer.Add(convertPosition.X);
CoordBuffer.Add(convertPosition.Y);
CoordBuffer.Add(convertPosition.Z);
}

for (int d = 0; d < CurrentMeshBuilder.Indices.Num(); d += 3)
{
int32 i0 = CurrentMeshBuilder.Indices[d + 0];
int32 i1 = CurrentMeshBuilder.Indices[d + 1];
int32 i2 = CurrentMeshBuilder.Indices[d + 2];

IndexBuffer.Add(i2);
IndexBuffer.Add(i0);
IndexBuffer.Add(i1);
}
}
}


I am also very interested in this answer since i have also plan to to use navmesh at server side. I hope someone know :slight_smile: