If the level has hidden sublevels, the regenerated navmesh result appears to have a hidden sublevel mesh placed at the origin.
Apparently, the reason is that bNavigationRelevant is no longer considered when exporting the mesh since 4.24.
The following workaround worked
void FNavigationDataHandler::UpdateActorAndComponentsInNavOctree(AActor& Actor)
{
INavRelevantInterface* NavElement = Cast<INavRelevantInterface>(&Actor);
if (NavElement)
{
UpdateNavOctreeElement(Actor, *NavElement, FNavigationOctreeController::OctreeUpdate_Default);
}
for (UActorComponent* Component : Actor.GetComponents())
{
INavRelevantInterface* CompNavElement = Cast<INavRelevantInterface>(Component);
if (CompNavElement)
{
// Component != null is implied by successful INavRelevantInterface cast
if (Actor.IsComponentRelevantForNavigation(Component) && Component->bNavigationRelevant ) //this line
{
UpdateNavOctreeElement(*Component, *CompNavElement, FNavigationOctreeController::OctreeUpdate_Default);
}
else
{
UnregisterNavOctreeElement(*Component, *CompNavElement, FNavigationOctreeController::OctreeUpdate_Default);
}
}
}
Result:
Incorrect navmesh is displayed in center of the level (0.0, 0.0, 0.0 ).
please see screenshots below.
1. opend level (sublevel is hidden)
[Image Removed]
2.moved a mesh and an incorrect navmesh is regenerated
[Image Removed]
3. once the sublevel will be visible
[Image Removed]
4. If hiding the sublevels again, the navmesh stays normal .
[Image Removed]
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-102671 in the post.
| 6 |
| Component | UE - AI - Navigation |
|---|---|
| Affects Versions | 4.24, 4.25, 4.26 |
| Created | Nov 6, 2020 |
|---|---|
| Resolved | Jul 19, 2022 |
| Updated | Jul 19, 2022 |