NavMesh, PathFollowing & Filters

Hi!

There are navigation mesh and pawns which are moving according to that meshes. As I can assume, I can somehow influence on formation of following path through filters. But there are totaly none of documentation about how to do it right. When I should influence (in which method)? How to do it properly? Maybe there are some examples.

Noone knows ?

I don’t know but would also be interested. I suggest you post the question on AnswerHub, making sure to add the AI tag. The UE4 devs are much more likely to see it.

As I can assume, developers answering only on bugreports in answerhub. I have a couple of topics not in this category and there are no answers.

It’s true at the moment it’s difficult to get direct help, however Miezsko who is working on AI fortunately seems to be an exception. Make your question specific, add the AI tag and I would think he’ll give you some feedback when he has the chance.

Hi ,

Have you taken a look at the wiki tutorials? There are quite a few tutorials on AI, specifically on guards, following specific paths, etc. Perhaps you can find something that will give you an idea of how to move forward? I am going to pass this information on to be considered for future documentation as well but that may be a place to start!

There aren’t any tutorials or examples for using navigation path filters in unreal. The only information that might be helpful would be outside Unreal recast information but that might be even more complicated than what people desire. The majority of the AI tutorials are for more simpler AI.

How to Influence Exact Path Following Behavior


Hi there!

As gif above shows there is a way to modify standard UE4 pathing via C++ to introduce customized path following behavior without rewriting the whole system.

In gif above I am telling the unit how to jump from one nav mesh piece to another using only C++ (nothing was placed in the editor other than basic nav mesh, and I can add new level geometry any time)

You need to do several things

  1. Have your own Custom ai controller (extends AAIController)

2. Tell ai controller to use custom path following component, which extends the base UE4 class

Here's the code for that, you just modify the constructor


```


//		UJoyPathFollowComp is used here!
AJoyController::AJoyController(const FObjectInitializer& ObjectInitializer)
   : Super(ObjectInitializer.SetDefaultSubobjectClass<**UJoyPathFollowComp**>(TEXT("PathFollowingComponent")))
{


```



  1. Make sure your build.cs is including AIModule as part of your dependencies


PublicDependencyModuleNames.AddRange(new string] { 
	"Core", 
	"CoreUObject", 
	"Engine", 
	"InputCore" ,
        "Landscape",
       "UMG",

        "PhysX",  "APEX",

	"AIModule"      //<~~~~~~
});


  1. Override these functions in your custom PathFollowingComponent!

Especially **FollowPathSegment **!

This is where you can take control of exact pathing methods!



//~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~
//	  Per Tick Modification of Path Following
//			this is how you really customize 
//				how units follow the path! 

/** follow current path segment */
virtual void FollowPathSegment(float DeltaTime) override;

/** sets variables related to current move segment */
virtual void SetMoveSegment(int32 SegmentStartIndex) override;
	
/** check state of path following, update move segment if needed */
virtual void UpdatePathSegment() override;



**Video Result**

Using the above method is how I made custom C++ Jump pathing calculations that dont need any in-editor additions to the level, just the basic nav mesh volume.


https://www..com/watch?v=0GX-1x-wACI


**More of my customized C++ AI Pathing Videos**
https://forums.unrealengine.com/showthread.php?25410--s-Multi-Threaded-Dynamic-Pathing-System-Full-Physics-Support&p=129896&viewfull=1#post129896

:)



PS:

turned this into a wiki here
https://wiki.unrealengine.com/AI_Navigation_in_C%2B%2B,_Customize_Path_Following_Every_Tick

There’s no need to change the default path following or crowd following component. The filters exist to work with the NavAreas in the environment and influence the default A* heuristics. There just aren’t any examples as said by the OP.