I’m trying to build a actor representing door generating at runtime.
Door has two states, open & close - just visual models are different, collision model for navmesh is the same (there is no navmesh under the door)
I want to create offmesh link to allow my agent to pathfind (and traverse) through this gap.
Here is the code:
m_OffMeshLink = GetWorld()->SpawnActor<ANavLinkProxy>();
m_OffMeshLink->AttachRootComponentToActor(this);
m_OffMeshLink->SetActorRotation(GetActorRotation());
m_OffMeshLink->SetActorLocation(GetActorLocation());
UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld()); //not nullptr
NavSys->RegisterCustomLink(*m_OffMeshLink->GetSmartLinkComp());
m_OffMeshLink->SetSmartLinkEnabled(false);
by default, navigation link should be disabled, but pathfinding still use it.
I think this should be handled in dtNavMeshQuery::passLinkFilter
but within this function
a) isLinkAllowed return always true
b) userId is always 0
so filter allows traversal of the link
(user id is 0 from NavLinkProxy constructor through all building process and there is no way to provide custom userId other than changing the engine code)
I think I’m doing something wrong.
What is the correct way to create off mesh link from c++ and be able to disable/enable it?