x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to create and enable-disable offmeshlink (navlink) from code

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?

Product Version: UE 4.12
Tags:
more ▼

asked Aug 27 '16 at 09:56 PM in C++ Programming

avatar image

Martin37
11 1 1

avatar image g1704252 Aug 30 '16 at 03:39 PM

Have you solve your issue somehow? I have almost the same issue - Intentional navmesh gaps with generated NavLinkProxy objects, but I don't know how do disable them

avatar image Martin37 Aug 31 '16 at 06:19 AM

Unfortunately not. I'm hoping someone answers it. If you made some progress, please, let me know

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question