AI: Finding Direct Path to Target
Hello UE4 Community,
Is there any way to check if a straight path from one actor to another is free? I would use the "Pathfinding Context" input for "Find Path to Actor Synchronously", but there doesn't seem to be any documentation about what exactly I should plug into it.
The problem comes in when I want to check for collisions along this path. When using a capsule trace, it only goes in a straight line, so any time the player and enemy are on a different elevation, the collision check will not be accurate. I'd much rather use the navigation system to my advantage by simply checking if I can move in a straight line on that path without running into any collisions, but I haven't found a way to do this.
NOTE: Even though I placed this in the Blueprint Scripting Section, I am willing to try a C++ solution. While I am by no means an expert with C++, I do have a decent amount of coding knowledge.
asked Aug 29 '16 at 07:08 PM in Blueprint Scripting
The PathfindingContext pin should be okay in most basic uses without hooking anything up to it. Just give it a reference to your pawn (the thing doing the pathfinding) if it isn't.
To tell whether you have a straight shot to the player, you can do one of two things - you can check to see if the length of the Path Points array provided by FindPath* is
answered Aug 29 '16 at 11:10 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here