Description

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);
			}
		}
	}

Steps to Reproduce
  1. Open attached project on 4.26 [Link Removed]
  2. Press p key to show navigation
  3. Drag a Ramp_StaticMesh in center of the level

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]

 

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-102671 in the post.

6
Login to Vote

Won't Fix
ComponentUE - AI - Navigation
Affects Versions4.244.254.26
CreatedNov 6, 2020
ResolvedJul 19, 2022
UpdatedJul 19, 2022