You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
[Navigation WP] Properly using the vertical bounds of the collected tiles as the NavigationDataChunkActor bounds
#review @Yoan.StAmant #rb Yoan.StAmant #fyi Richard.Malo, JeanFrancois.Dube #jira none [CL 14641645 by Aris Theophanidis in ue5-main branch]
This commit is contained in:
@@ -2092,13 +2092,13 @@ void ARecastNavMesh::ApplyWorldOffset(const FVector& InOffset, bool bWorldShift)
|
||||
RequestDrawingUpdate();
|
||||
}
|
||||
|
||||
void ARecastNavMesh::FillNavigationDataChunkActor(const FBox& Bounds, ANavigationDataChunkActor& DataChunkActor) const
|
||||
void ARecastNavMesh::FillNavigationDataChunkActor(const FBox& QueryBounds, ANavigationDataChunkActor& DataChunkActor, FBox& OutTilesBounds) const
|
||||
{
|
||||
if (RecastNavMeshImpl)
|
||||
{
|
||||
UE_LOG(LogNavigation, Verbose, TEXT("%s Bounds pos: (%s) size: (%s)."), ANSI_TO_TCHAR(__FUNCTION__), *Bounds.GetCenter().ToString(), *Bounds.GetSize().ToString());
|
||||
UE_LOG(LogNavigation, Verbose, TEXT("%s Bounds pos: (%s) size: (%s)."), ANSI_TO_TCHAR(__FUNCTION__), *QueryBounds.GetCenter().ToString(), *QueryBounds.GetSize().ToString());
|
||||
|
||||
const TArray<FBox> Boxes({ Bounds });
|
||||
const TArray<FBox> Boxes({ QueryBounds });
|
||||
TArray<int32> TileIndices;
|
||||
RecastNavMeshImpl->GetNavMeshTilesIn(Boxes, TileIndices);
|
||||
if (!TileIndices.IsEmpty())
|
||||
@@ -2109,6 +2109,7 @@ void ARecastNavMesh::FillNavigationDataChunkActor(const FBox& Bounds, ANavigatio
|
||||
DataChunkActor.GetMutableNavDataChunk().Add(DataChunk);
|
||||
|
||||
DataChunk->GetTiles(RecastNavMeshImpl, TileIndices, EGatherTilesCopyMode::CopyData);
|
||||
DataChunk->GetTilesBounds(*RecastNavMeshImpl, TileIndices, OutTilesBounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,3 +437,18 @@ void URecastNavMeshDataChunk::GetTiles(const FPImplRecastNavMesh* NavMeshImpl, c
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void URecastNavMeshDataChunk::GetTilesBounds(const FPImplRecastNavMesh& NavMeshImpl, const TArray<int32>& TileIndices, FBox& OutBounds) const
|
||||
{
|
||||
OutBounds.Init();
|
||||
const dtNavMesh* NavMesh = NavMeshImpl.DetourNavMesh;
|
||||
|
||||
for (const int32 TileIdx : TileIndices)
|
||||
{
|
||||
const dtMeshTile* Tile = NavMesh->getTile(TileIdx);
|
||||
if (Tile && Tile->header)
|
||||
{
|
||||
OutBounds += Recast2UnrealBox(Tile->header->bmin, Tile->header->bmax);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user