How to use navlink in the detour crowd implementation

how we use the navlink, in the crowd simulation.
when i read the code in crowdFollowingComponent. i think because the pathing was handled by detourCrowd. so the information about the segment is being kept in the detour. how we access that?? so we can know. what segment is navlink and in what segment we are. are we have to make a inheritance class from crowd manager to do so??

please help :slight_smile:

Segment data is buried deep inside DetourCrowd code and accessing it is quite annoying. Maybe you can use UCrowdFollowingComponent::OnNavNodeChanged() in your derived path following class to react on starting a navlink?

Something along lines:

void UMyPathFollowingComponent::OnNavNodeChanged(NavNodeRef NewPolyRef, NavNodeRef PrevPolyRef, int32 CorridorSize)
{
	Super::OnNavNodeChanged(NewPolyRef, PrevPolyRef, CorridorSize);

	FNavMeshNodeFlags Flags;
	ARecastNavMesh* NavMesh = Path.IsValid() ? Cast<ARecastNavMesh>(Path->GetNavigationDataUsed()) : nullptr;
	if (NavMesh)
	{
		NavMesh->GetPolyFlags(NewPolyRef, Flags);

		FVector LinkA;
		FVector LinkB;
		if (Flags.IsNavLink() && NavMesh->GetLinkEndPoints(NewPolyRef, LinkA, LinkB))
		{
			const UClass* AreaClass = NavMesh->GetAreaClass(Flags.Area);

			// ...
		}
	}
}

thx for the fast response lukasz!!.
i will try and inform you if this allright…

regards

ok. thx for lukasz the problem is solved, but the function is change a little bit, so this is how i solved it ::

ARecastNavMesh* NavMesh = Path.IsValid() ? Cast(Path-GetNavigationDataUsed()) : nullptr;
  

 if (NavMesh)
  { 

     uint16 AreaFlags; // area flags that we define in the NavArea class 
    uint16 PolyFlags;

            //the signature is different in 4.8
             NavMesh->GetPolyFlags(NewPolyRef, PolyFlags, AreaFlags);
    
            /// use the AreaFlags, for example compare it with the areaFlags of NavArea class that we use to. i recommend to make some kind of enum of NavArea type that we used. and then compare that to the AreaFlags
    
    if(AreaFlags == <EnumOfNavArea>areaFlags)
    {
     // do something.
    }   
}