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"

[Closed] How do we get an AI to jump across a NavProxyLink?

[Yay I got the formatting to work!!]

So my AI will find a path using the NavProxyLinks no problem, but they won't jump at those link. I figured there is some hook for us to implement what to do when we get there. It looks like that is the case, but that "hook" isn't getting fired.

Looking into it, the path following comp uses SetMoveSegment to move the AI along the path. In that function, we have

     // handle moving through custom nav links
     if (PathPt0.CustomLinkId)
     {
         UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld());
         INavLinkCustomInterface* CustomNavLink = NavSys->GetCustomLink(PathPt0.CustomLinkId);
         StartUsingCustomLink(CustomNavLink, SegmentEnd);
     }

This seems to be the entry point for us to be able to do custom logic, but we never get in there because CustomLinkId is always 0. It looks like the customid is set after we get a path back from recast in FPImplRecastNavMesh::FindStraightPath. All this code executes fine, but the offMeshCon->userId we get from the dtOffMeshConnection is also zero. Looking that var up, the comment says

 /// The id of the offmesh connection. (User assigned when the navigation mesh is built.)
 unsigned int userId;

But what does "user" mean in this case? Since I'm in the recast code at this point. I'm guessing the user is the epic code base. So I'm kinda at a loss how this is applied on our end. dtCreateNavMeshData is what is called when navmesh is built and that takes a params that has a user id in it. But that userId is never set as far as I can tell.

I was wondering if I'm not seeing a code path that sets this id or if there is some magic going on that I'm missing. But how do you guys get this tech to work?

Product Version: Not Selected
Tags:
more ▼

asked Jun 17 '16 at 08:32 PM in C++ Programming

avatar image

Answers.Archive STAFF
1.9k 197 306 679

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

The question has been closed Jun 17 '16 at 08:34 PM by AndrewHurley for the following reason:

The question is answered, right answer was accepted


1 answer: sort voted first

Hey Troy,

When using NavLinkProxy pay attention which kind of links you're setting up, since it supports two types and one can easily misconfigure it (I know I did!). There are PointLinks in category Simple Link and there's SmartLinkComp (in code) exposed as properties in SmartLink category. There's a bit of naming confusion in the code that we haven't had a chance to clean up yet - "smart links" are the same as "custom links".

Having those two distinguished I'd suggest using point links as much as possible, for performance reasons. I've described using those those for jumping in this Epic's wiki page. It's from two years ago so let me know if something is not right, if you decide to do this path.

The "custom links" are the other type, and those are the ones allowing you to plug in complex logic, or get notifies when AI starts to use such a link. They're a lot more flexible, but of course it comes with a cost (not a terrible one, but more expensive then simple links nonetheless). If you double check that those are the ones your NavLinkProxies are setup to use, and as you say it doesn't work, then please follow up on this thread so that we can investigate that.

Cheers,

--mieszko

more ▼

answered Jun 17 '16 at 08:32 PM

avatar image

Answers.Archive STAFF
1.9k 197 306 679

avatar image Answers.Archive STAFF Jun 17 '16 at 08:32 PM

Thanks, got it no prob. The wiki seems to be dated though. I think it uses an old object initialize struct. So you may want to update that. But it wasn't a huge problem.

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

Follow this question

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

Answers to this question