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?

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

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.