About Store Forum Documentation Contact

Post Reply 
[World.PathFind] Behavior of partial pathfinding
Author Message
KraaxLeNain Offline

Post: #1
[World.PathFind] Behavior of partial pathfinding
Hi all,

Since the fix in pathfin for partial or no partial path (see PostOnPartialPathfinding) I've been messing around again with this feature.

So what I'm trying to do is to have the closest point to my destination in straight line. I thought, hell let's use pathfinding in "closest" mode :
Game.World.path().find(Chrs[0].pos(), phys_hit.plane.pos,  Chrs[0].path, 2, PMF_WALK, true);

but the result is not what attended, it's more like it's searching the total path for the closest point, then truncate it only two keep the first two points and not try to find in 2 points the closest path.
[Image: Esenthel_Path2.jpg]

It's surely because of the way of how it's build, woch might defer from the goals I'm trying to reach.

As anyone tryed to do the same thing and used other tools ? I'm seeing possible quickfixes (raycast to check when I go out of the pathmesh ? regular check on the pathmesh ?)... But their must be cleaner ways (I couldn't find EE2.0 pthfind source code so I assume it's not accessible with EE2.0 licence ? ...).

Have a nicea day all !
05-08-2014 02:36 PM
Find all posts by this user Quote this message in a reply
para Offline

Post: #2
RE: [World.PathFind] Behavior of partial pathfinding
From the screenshot:
1.) you clicked on a WALKABLE point on the path, so either partial or full "mode" will return the same FULL path.
2.) in the find() call you use step size of 2, hence the "truncation", use -1 instead

With step size 0 and partial set to true, If I click let's say in the middle of the rocks, I get the closest point on the navmesh like you seem to want, but the path is not always straight, ie. if there was be a tree in the way it would go around it...

But if you want to go strictly in a straight line fashion, use path().ray() to find the point you are trying to get in the screenshot. (note that it will not avoid trees etc)
You should also look into path().nearestSurface(), I found this to be very handy in many situations...
05-12-2014 07:36 AM
Visit this user's website Find all posts by this user Quote this message in a reply
KraaxLeNain Offline

Post: #3
RE: [World.PathFind] Behavior of partial pathfinding
Yep, I know I clicked on a walkable path that's the point wink

I'll try "-1" to see how it behave.

But still, I find the approach quite odd : for me a partial pathfinding with limited number of step should find closest point to destination with the step limitation (Aka : how much close you can be using 3 direction changes for instance) and not just truncate a fuller path (which also means that it's searching for this path and does not limit itself to X step paths).

Anyway, it might be done that way for good reasons that don't cross my mind.

Path.ray would be use indeed if I want to go in strictly straight line fashion, but the point of using partial path and step limitation is here for me to have a "slight" path correction (for instance, slightly correct the path in order to avoid small obstacles, using pathfind and controlling the deviation, by calculating length of the path and comparing it to straight path for while authorizing only a length of 110% or something similar).

Thx for your answer smile
(This post was last modified: 05-19-2014 08:34 AM by KraaxLeNain.)
05-19-2014 08:23 AM
Find all posts by this user Quote this message in a reply
KraaxLeNain Offline

Post: #4
RE: [World.PathFind] Behavior of partial pathfinding

So -1 just return the full path... So it's not really a change.

Here are few "disturbing things" in my opinion :
1) I still have results for paths that should not be found with "allow_partial_path = false" ... Like ones close from the path... This should not happen : the path from A to B does not exist in the path mesh. Is it a tolerance, based on the controller capsule size ? Can it be disabled ?

(see picture bellow)

[Image: 579471Bug1.jpg]

2) Limited step paths : it's just a truncation of the best full path, whether or not you allow partial path... I see few problems about that :
A) In a labyrinth for instance, if you want to limit yourself to only 2 or 3 moves to see if a move is "doable" in order not to make thousands of calculations, the algorythm will still search the full path to the target, even if it has more steps then allowed : a waste a calculation time.
B) An allowed but longer path will not be found, while it should be ! See folowing pictures : there is an obvious 2 line path but since it's working with only a truncation of full path the "obvious path" in two move is not found.
[Image: 367302Bug2.jpg]

[Image: 946979Bug3.jpg]

[Image: 446663Bug4.jpg]

I think it will be an improvement for the engine if these points were clarified or modified.

If I'm not undestandable I'll gladly develop... And if this has beeen fixed in the latest releases I deeeply appologise for the annoyance ^^

PS : ENGINE BUILD 29 EDITOR BUILD 14... a bit old but I plan on getting a new Licence soon (well at least if this is corrected I'll have to use a new one especially to test it ^^).

Good day everyone.
08-04-2014 08:06 PM
Find all posts by this user Quote this message in a reply
Post Reply