's Multi-Threaded Dynamic Pathing System, Full Physics Support

Pretty darn nice. :slight_smile:

is awesome !

Keep up the awesome work :smiley:

Hee hee! * Blushes *

Thanks! Great to hear from you!

:slight_smile:

Any you could share some of the code for the jumping? ( I haven’t seen whether you have already or not )

Hey

Awesome work! I can’t tell you enough how many times your posts and answers scattered throughout the Unreal World, have helped steer me in the right direction on multiple occasions.

I have been trying to do a similar path finding jump as your videos above, but am getting stuck on one part, On your #140 comment , the video shows some dynamic path finding and jumps being made by the AI to get to the player. I have been looking at the Recast Nav mesh and am able to find the nearest poly and the get all polys methods you posted but the find nearest seems to only return a poly on the same area and the find all polys returns everything it seems. Is there a find nearest poly between two areas? I cant seem to find a query function that finds where the AI should start its path at, given the player being a couple jumps away. In your example video, I see you have two poly areas being highlighted the yellow ones that signal where the AI should move to and the green ones that signal where to jump to. Is it possible to shed some light on how to get those polys? I don’t care about sharing code as much as just an explanation of the idea you used, as I still want to learn for myself, just cant seem to figure out a way to accomplish that part.

Thanks !

Yaay! I’m glad to have helped out!

That was actually the most complex part, I did a bunch of geometric tests to identify the proper points using FBox and line tests.

After obtaining the FBox that represents each poly, I then did a bunch of tests to see which one was the best for the unit to use :slight_smile:

Here’s the function I created in my custom PathFollowingComponent to initiate my geometric tests:



//Verts
bool NavPoly_GetVerts(const NavNodeRef& PolyID, TArray<FVector>& OutVerts);

//Bounds
FBox NavPoly_GetBounds(const NavNodeRef& PolyID);

//Choose Which Nav Data To Use
FORCEINLINE const ANavigationData* JoyGetNavData() const
{
	const FNavAgentProperties& AgentProperties = MovementComp->GetNavAgentPropertiesRef() ;
	const ANavigationData* NavData = GetNavDataForProps(AgentProperties) ;
	if (NavData == NULL)
	{
		NavData = GetMainNavData();
	}
	   
	return NavData;
}

//~~~
bool UJoyPathFollowCompHighest::NavPoly_GetVerts(const NavNodeRef& PolyID, TArray<FVector>& OutVerts) 
{
	//Get Nav Data
	const ANavigationData* NavData = JoyGetNavData();
	 
	const ARecastNavMesh* NavMesh = Cast<ARecastNavMesh>(NavData);
	if(!NavMesh)
	{
		return false;
	}
	
	return NavMesh->GetPolyVerts(PolyID,OutVerts);
}

//Get Box of individual poly from verts
FBox UJoyPathFollowCompHighest::NavPoly_GetBounds(const NavNodeRef& PolyID)
{
	TArray<FVector> Verts;
	NavPoly_GetVerts(PolyID,Verts);
	
	FBox Bounds(0);
	for(const FVector& Each : Verts)
	{
		Bounds+=Verts;
	}
	
	return Bounds;
}



**Geometric Analysis Using FBox**

I had to do all the geometric analysis myself! 

I recommend you check out all the convenience functions in:

**UnrealMathUtility.h**

and

**Box.h**

These are the basic tools you can use to do the analysis yourself to find the best spot!

Essential Function

I especially recommend checking out a fast trace you can do using a Line Box intersection:

UnrealMathUtility.h



/** Determines whether a line intersects a box. */
static bool **LineBoxIntersection**( const FBox& Box, const FVector& Start, const FVector& End, const FVector& Direction );

/** Determines whether a line intersects a box. overload avoids the need to do the reciprocal every time. */
static bool** LineBoxIntersection**( const FBox& Box, const FVector& Start, const FVector& End, const FVector& Direction, const FVector& OneOverDirection );

/* Swept-Box vs Box test */
static CORE_API bool **LineExtentBoxIntersection**(const FBox& inBox, const FVector& Start, const FVector& End, const FVector& Extent, FVector& HitLocation, FVector& HitNormal, float& HitTime);




**Multi-Threading**

I multi-threaded my final solution to result in best performance.

Good Luck!

I look forward to hearing about your chosen implementation!

:slight_smile:

AI Dodge Wiki

Dear Community,

I’ve just posted a C++ wiki on implementing an AI Dodge mechanic!

In just a few lines of code I show you how you can tell an AI unit to dodge left or right, and how far, and also ensure the UE4 Navigation System will find the calculated dodge point using Nav Mesh Projection!

AI Dodge Wiki

Enjoy!

Hi
Just want to know, you remake navigation system or add extra validation on unreal path finding system?
is can be implementable to big landscape like open world game? because you got all polys…

:slight_smile:

I am using UE4 navigation system for my more recent jump pathing videos, I’ve also created my own navigation systems / nav mesh / AI path following, from scratch!

Epic has a nice way to stream in nav meshes, and also nav meshes can be separated, so that the lookup of all polys is local to the units nearest nav mesh, meaning I am not looking up all polys in the entire open world

:slight_smile:

's Physics Character Pathing System

One of my favorite AI Victories!

I overrode and rewrote large portions of Epic’s Character AI Pathing system to work with physics simulating characters!

There’s no native support for , but using some of my own functions that I’ve been writing for my physics multiplayer game, I was able to do it!

Epic very nicely exposed as virtual all the functions I needed to override, thank you Epic!

Here is the result!

https://youtube.com/osC5GI_t7Ic


**PhysX Creature That Can Navigate the UE4 World ~ Evolution**

I then evolved system into my own game here:

https://youtube.com/d7mAhStMABo

PhysX Creature Navigating In Dynamically Generated World

core C++ coding research then enabled me to do what you see in video with my in-game level editor and some physx-simulating ball creatures!

https://youtube.com/DtTN52_oTfQ

:heart:

Very awesome AI pathing projects thanks for sharing.

Was looking over the thread, and could possibly be pretty useful to me, as I am always in search of the next optimization. In regards to the cow mesh + animation, are your cows able to do :?

https://youtube.com/aFxquCZehFk

I loved the backflip at the very end :slight_smile:

Also the sub-dividing cows were great :slight_smile:

Ramas the man as always.

Would be nice to see some code, though. Or pseudocode.

I’m working with root-motion based locomotion at the moment, and snippets would help.

Hee hee! Very nice to hear from you !

:heart:

:slight_smile: Thanks

great work~
but, where is the code or built plugin?..

Yeah, that would be perfect if you can share or sell your system, :slight_smile:

so did die?