DoN's 3D-Pathfinding / Flying-AI system (with full source!)

To clarify, no part of a pawn’s locomotion is handled by this plugin. After solving a path, it simply hands all movement logic over to your pawn via AddMovementInput so your pawn’s movement component is the right place to investigate issues like this. In any case, glad to hear it was solved.

By “destroy path” I’m guessing you mean the black lines that depict a solved path? If so, you just need to disable the relevant debug option from the Fly To node’s Query Params (all the visualize solution flags need to be turned off).

For your second question you’ll have to check the logs and see what error message is being shown. If your drone can’t fly after being spawned it is indicative of some other fundamental issue; it has nothing to do with the previous bot’s path (which are just debug lines)

Thank you :slight_smile:

Hi
HELP! I’ve got this working great. it’s awesome…BUT…I’ve got 3 maps, each with a different gamemode because each map uses a different character/pawn. When i load the maps manually and run them one at a time everything works perfectly; the AI finds its waypoints and my flying saucers follow their paths perfectly every single time. however, when I call a map from ANYWHERE within the program (on a map after i complete a task, hit a trigger box, etc.) when the new map loads the flyingAI doesn’t pick up the waypoints and my saucers go flying off into space. I CANNOT figure this out and it’s driving me nuts! do i need a delay on beginplay or something? any help would be appreciated!
thank you!

Hello,
I can’t get the SchedulePathfindingTask node to work. I see a built path, but no movement takes place. Like in your demo, my Actor is a descendant from DefaultPawn and AIController class is FlightAIController

You’re a cod among goldfish!

Answering my own question - this method only builds a path, but does not do any movement. Also the path optimization engine needs some …optimization.
In other scenarios - great component.

Hello. For those who are digging this topic, I had some experiments not so long ago, here are my video with all relevant links (including sample project) in description:watch?v=jnrZBlBkkq8Disclaimer: I am using commercial “SixDOF” flying component for ship movement.

We need a functions like:
AbortDynamicCollisionUpdateTask()
RemoveDynamicCollisionObject()

Now the only way remove a dynamic object is to move to the edge of the map.

hey !

your plugin is awesome but, almost every time i launch the game I got this crash error:
(i’m using the blackboard way)

Fatal error!

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00007098

0x000000001987CAEF UE4Editor-DonAINavigation.dll!TSet<AActor * __ptr64,DefaultKeyFuncs<AActor * __ptr64,0>,FDefaultSetAllocator>::FindId() [d:\rocketsync\4.19.0-3944462+++ue4+release-4.19\working\engine\source\runtime\core\public\containers\set.h:623]
0x00000000198905A9 UE4Editor-DonAINavigation.dll!UBTTask_FlyTo::SchedulePathfindingRequest() [d:\build++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\donainavigation\source\donainavigation\private\behaviortree\bttask_flyto.cpp:92]
0x000000001987C0DC UE4Editor-DonAINavigation.dll!UBTTask_FlyTo::ExecuteTask() [d:\build++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\donainavigation\source\donainavigation\private\behaviortree\bttask_flyto.cpp:58]
0x00000000280D8EED UE4Editor-AIModule.dll!UnknownFunction ]
0x00000000280F668F UE4Editor-AIModule.dll!UnknownFunction ]
0x000000002810F600 UE4Editor-AIModule.dll!UnknownFunction ]
0x000000002ADFD628 UE4Editor-Engine.dll!UnknownFunction ]
0x000000002AE30184 UE4Editor-Engine.dll!UnknownFunction ]
0x000000002BB0690B UE4Editor-Engine.dll!UnknownFunction ]
0x000000002BB0BFE3 UE4Editor-Engine.dll!UnknownFunction ]
0x000000002DB0B713 UE4Editor-Core.dll!UnknownFunction ]
0x000000002DB0BA50 UE4Editor-Core.dll!UnknownFunction ]
0x000000002BB2CD35 UE4Editor-Engine.dll!UnknownFunction ]
0x000000002BB32AE2 UE4Editor-Engine.dll!UnknownFunction ]
0x000000002B38BF04 UE4Editor-Engine.dll!UnknownFunction ]
0x000000002B397429 UE4Editor-Engine.dll!UnknownFunction ]
0x0000000028FFD781 UE4Editor-UnrealEd.dll!UnknownFunction ]
0x0000000029899516 UE4Editor-UnrealEd.dll!UnknownFunction ]
0x00000000A1D55EAC UE4Editor.exe!UnknownFunction ]
0x00000000A1D66BD0 UE4Editor.exe!UnknownFunction ]
0x00000000A1D66C4A UE4Editor.exe!UnknownFunction ]
0x00000000A1D74149 UE4Editor.exe!UnknownFunction ]
0x00000000A1D75B57 UE4Editor.exe!UnknownFunction ]
0x000000007E011FE4 KERNEL32.DLL!UnknownFunction ]
0x000000008066F061 ntdll.dll!UnknownFunction ]
0x000000008066F061 ntdll.dll!UnknownFunction ]

Could somebody help me undersand what’s not working ?
Maybe it is a bug ?

Have a nice day !

Hi there,

I’m relatively new to game dev, and I have what I hope is a quick question,

Does the “Fly To” blackboard task guide an actor along the “Data Path Solution Optimized?” vector array returned by the result handler delegate?

I ask because I’m working over someone else’s code, and in order to have an actor guide the player to an objective, they used “Fly to” on each subsequent vector in the optimized data path.

This causes the actor to pause at each vector, and check if the player is with them. With a small voxel size, this movement looks rather strange and stilted.

I was wondering if it might be easier (and more aesthetically pleasing) to instead impose a short time limit on the Fly To task, and use the final objective as the Flight Location Key.

The idea being that actor would move as far as it could in the time allotted, then check for the player before moving again.

Thoughts?

@ Hi, the plugin is amazing but I’m worried about performance. My level is 32km*32km and I’m using world composition (level streaming) so it has 64x64 tiles. I Think Infinite Navigation might be extremely costly on my map. So I need something like Navigation invoker component (A component that generate navigation around pawn/character dynamically). Do you have any plans for something like that? Or any suggestion to achieve my goal with low frame time cost?

I was trying to convert this into a more specific flocking algorithm instead of individual paths for everything, but have no luck so far :frowning:

For anyone who encounter this error.

The cause is that pawn’s current location is outside DonNavigation’s bound.
So, the NavigationManager variable point to nullptr. In C++, It’s possible to dereference nullptr without getting exception but getting crash inside object instead.

hello,
i’ve been using this plugin and its great, but i am wondering about using it for forward-flying objects like airplanes (or ships, limited to one Z plane) where there is no going sideways or backwards… is there an easy way to limit the FLYTO movement to one axis (X or Y) so that my bot always goes “forward” and “turns” around obstacles? I’ve been trying to utilize this particular scenario and end up with bots travelling sideways or backwards, which is unrealistic. I’ve been searching this forum without much luck, perhaps I am overlooking a solution?
thanks!

  • s

My best guess is, you need to set separate object (obstacle) avoidance that kicks in, when it is needed. In fact, in my flying game experiments, with arcade-ish flying enemies, I have no path finding system “per se” at all. I have basic rules where to fly (to player, fly away from player, go random), and object avoidance (i call it “cat whiskers” because of line tracing likeness). For me, that works fine for now. You can see it “live” in my videos. I have been experimenting with this 3D pathfinding too (also there is a video), it was fine, but I have avoided it for now.

One quick thing to try…can you set the AI unit focus to the direction of the units velocity? That should always turn the unit towards it’s flight direction over time.

Alternatively, if you’re in C++…have a look at UBTTask_FlyTo::TickPathNavigation. You can adjust that implementation to meet your needs.

I was trying to find the custom event customAddMovementInput like the one below for a day or two, but was having no luck. I can find the customAddMovementInput (message) and (interface), but not the (event). I see that the target of this custom event is DonNavigator, but neither did I find the object with the class DonNavigator, nor the class DonNavigator. I am using the bp plugin from Unreal MarketPlace. Am I missing something?

https://forums.unrealengine.com/filedata/fetch?filedataid=145854

I see thanks. By the way, it seems like DoN’s 3D-Pathfinding doesn’t support Physics volume? If the Physics volume overlaps with the Don’s Navigation Manager, the pawn/character won’t move.
FYI, both “FindGoal” and “FlyTo” nodes in Behavior tree continuously flashes when Don’s Navigation manager overlaps with Physics volume. If not, “FindGoal” is supposed to finish before “FlyTo”.

Update:

These errors will pop up:
DoNNavigationLog: Warning: Pawn’s initial/final position overlaps an obstacle. Attempting to find substitute vector (a nearby free spot) for pathfinding…
DoNNavigationLog: Error: Error: Invalid Origin (X=820.000 Y=810.000 Z=398.000) passed to navigation path solver
DoNNavigationLog: Error: Error: Invalid Destination (X=210.000 Y=-10760.000 Z=2000.000) passed to navigation path solver

Is the Don’s Navigation Manager treating the physics volume as an obstacle?

@Grot13 By the means of locomotion system, do you mean the skeletal system? If so, how did you change it such that it works in a water volume? Do you have to change something outside of Unreal? I haven’t really had much experience on locomotion system before.

Btw, I’ve changed the settings of the character blueprint, such that the Default Movement Mode When In Water is Flying instead of Swimming. And for Nav Movement, I’ve disabled IsSwimming, and enabled IsFlying. However, it still doesn’t move in the Physics Volume.

So, the plugin suddenly started making problems. Haven’t changed anything about the nav, as I’ve been dealing with level design recently. And yet – what used to work, now crashes the engine.
[SPOILER]



Access violation - code c0000005 (first/second  not available)

UE4Editor_DonAINavigation!TSet<AActor *,DefaultKeyFuncs<AActor *,0>,FDefaultSetAllocator>::FindId() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\core\public\containers\set.h:631]
UE4Editor_DonAINavigation!UBTTask_FlyTo::SchedulePathfindingRequest() [g:\engines\unreal\source\ue_4_20\engine\plugins\marketplace\donainavigation\source\donainavigation\private\behaviortree\bttask_flyto.cpp:92]
UE4Editor_DonAINavigation!UBTTask_FlyTo::ExecuteTask() [g:\engines\unreal\source\ue_4_20\engine\plugins\marketplace\donainavigation\source\donainavigation\private\behaviortree\bttask_flyto.cpp:58]
UE4Editor_AIModule!UBehaviorTreeComponent::ExecuteTask() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\aimodule\private\behaviortree\behaviortreecomponent.cpp:1687]
UE4Editor_AIModule!UBehaviorTreeComponent::ProcessExecutionRequest() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\aimodule\private\behaviortree\behaviortreecomponent.cpp:1448]
UE4Editor_AIModule!UBehaviorTreeComponent::TickComponent() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\aimodule\private\behaviortree\behaviortreecomponent.cpp:1172]
UE4Editor_Engine!FActorComponentTickFunction::ExecuteTickHelper<<lambda_e8384def656dc646af48282ce274db64> >() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\engine\classes\gameframework\actor.h:3095]
UE4Editor_Engine!FActorComponentTickFunction::ExecuteTick() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\engine\private\components\actorcomponent.cpp:797]
UE4Editor_Engine!TGraphTask<FTickFunctionTask>::ExecuteTask() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\core\public\async	askgraphinterfaces.h:829]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\core\private\async	askgraph.cpp:665]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilIdle() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\core\private\async	askgraph.cpp:585]
UE4Editor_Engine!FTickTaskSequencer::ReleaseTickGroup() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\engine\private	icktaskmanager.cpp:558]
UE4Editor_Engine!FTickTaskManager::RunTickGroup() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\engine\private	icktaskmanager.cpp:1455]
UE4Editor_Engine!UWorld::RunTickGroup() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\engine\private\leveltick.cpp:780]
UE4Editor_Engine!UWorld::Tick() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\engine\private\leveltick.cpp:1466]
UE4Editor_UnrealEd!UEditorEngine::Tick() [g:\engines\unreal\source\ue_4_20\engine\source\editor\unrealed\private\editorengine.cpp:1691]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [g:\engines\unreal\source\ue_4_20\engine\source\editor\unrealed\private\unrealedengine.cpp:403]
UE4Editor!FEngineLoop::Tick() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\launch\private\launchengineloop.cpp:3495]
UE4Editor!GuardedMain() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\launch\private\launch.cpp:166]
UE4Editor!GuardedMainWrapper() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\launch\private\windows\launchwindows.cpp:144]
UE4Editor!WinMain() [g:\engines\unreal\source\ue_4_20\engine\source\runtime\launch\private\windows\launchwindows.cpp:223]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

[/SPOILER]
I’ve dealt with access violation once before, it was due to the pawn being out of the nav volume bounds. It is not the case this time, I made double-sure of that.

UE 4.20.2, Blueprint project
Relevant screenshots: DoN's 3D Pathfinding woes - Album on Imgur

This may be a stupid question because this specifies that it is a flying AI system, but is there a way to query the system for land-bound paths and to prevent traversal of steep slopes?
I have a relatively large voxel world with player-spawned structures, and while navmeshes work I am looking for a more optimized approach for NPC movement.
The system would not have to handly many actors at once, pathfinding would only be activated when a player is nearby and actively being chased.

If the system cannot be used in this scenario I would appreciate any pointers for other options.
Thank you!