Hello,
I have a level which I have added a NavMeshBoundsVolume to via the editor.
After spawning some static mesh instances I’d like to update the location and bounds of the ANavMeshBoundsVolume instance I placed in my level. I’m attempting to do so like so :
UNavigationSystem* NavSystem = GetWorld()->GetNavigationSystem();
if (NavSystem)
{
for (TActorIterator<ANavMeshBoundsVolume> It(GetWorld()); It; ++It)
{
ANavMeshBoundsVolume* V = (*It);
if (V != NULL && !V->IsPendingKill())
{
V->SetActorLocation(FVector(0, 0, 0));
UBrushComponent* Brush = V->GetBrushComponent();
Brush->Brush->Bounds = FBox(FVector((this->Bounds->x() * 100), (this->Bounds->y() * 100), 0), FVector(((this->Bounds->x() + this->Bounds->width()) * 100), ((this->Bounds->y() + this->Bounds->height()) * 100), 200));
NavSystem->OnNavigationBoundsUpdated(const_cast<ANavMeshBoundsVolume*>(V));
}
}
}
It looks like the location of my nav mesh bounds volume is updating, but the bounds of the brush don’t seem to have changed.
Any idea what I’m doing wrong here? Examples about this kind of thing are pretty sparse.
Thanks!
Edit : Apparently there was some previous discussion about the topic here: How to build navmesh for dynamically sized procedural level - World Creation - Epic Developer Community Forums