KraaxLeNain
Member
|
[Solved] MoveTo find closest destination when unreachable place.
Hi there,
Solved : pathfinding has now an option "find closest point on fail" which can be deactivated (default : activated).
Using the pathfinding tutorial I've spotted bugs in pathfinding. It seems that sometimes when reaching destinations non-accessible it finds it anyway and go crash onto the walls. I hope it is a bug not a feature
See two pictures below :
Accessing a walkable but unreachable destination
Trying to acces an unreachable destination
If it's not bug then... I'm missing something
(This post was last modified: 02-03-2014 11:13 AM by KraaxLeNain.)
|
|
01-20-2014 04:43 PM |
|
Esenthel
Administrator
|
RE: Error in pathfinding
Hi,
This is not a bug, it simply finds the nearest possible location to the target destination.
|
|
01-21-2014 08:11 AM |
|
KraaxLeNain
Member
|
RE: Error in pathfinding
Ok.
So this is a feature ? I assumed pathfinding should return false when not able to find a path. Then I have few questions :
-When does pathfinding return false in this case (fail to find path) ?
-Can we disable this "find nearest location" ?
-Is it still working the same way using the length path limitation ?
Maybe I've misread the Character source code and then it's not the pathfinding which decide it but the "moveTo" dynamics which try to find nearest location when failing to go to this specific place ?
Also would it be possible to add in Chr class MoveTo (Vec destination, float pathlength=0) for managing the path length limitation on the character class easily ?
Having character class source code I may override it, but I think it's a "cheap to do" features that might interest the community.
Thanks for the answers !
Best regards,
Kraax.
(This post was last modified: 01-21-2014 11:24 AM by KraaxLeNain.)
|
|
01-21-2014 09:24 AM |
|
Esenthel
Administrator
|
RE: [Not a bug but a feature] MoveTo find closest destination when unreachable place.
You can do a compare on the target position and the last found waypoint if they're equal.
|
|
01-21-2014 09:33 AM |
|
KraaxLeNain
Member
|
RE: [Not a bug but a feature] MoveTo find closest destination when unreachable place.
Ok,
But it means that the pathfinder will still calculate it right ? So it might "loose" some time to find a location that we might not be interested in ?
Would it be possible to deactivate this feature in the pathfinding to avoid performance drops when using it for large amount of units ? Or at least change the source code comment saying "false on fail" for ". If not reachable will find nearest reachable point (false if this fails too)."
Just a suggestion
(This post was last modified: 01-21-2014 10:21 AM by KraaxLeNain.)
|
|
01-21-2014 10:18 AM |
|
Esenthel
Administrator
|
RE: [Not a bug but a feature] MoveTo find closest destination when unreachable place.
Hi,
Next version will have this method updated (please see the 'allow_partial_paths') :
Bool find(C Vec &start, C Vec &end, Memp<Vec> path, Int max_steps=-1, UInt walkable_flags=PMF_WALK, Bool allow_partial_paths=true)C; // find path from 'start' to 'end' world position, 'max_steps'=maximum number of allowed steps in the result path (use <=0 for unlimited), 'walkable_flags'=faces that are walkable (PATH_MESH_FLAG), 'allow_partial_paths'=if there is no direct path from 'start' to 'end' then return partial path to the point closest to the 'end', false on fail (path not found)
|
|
01-22-2014 07:41 AM |
|
KraaxLeNain
Member
|
RE: [Not a bug but a feature] MoveTo find closest destination when unreachable place.
Hi,
Thanks for this option, it'll be mush more clearer on what pathfind exactly do (and can do !).
I'll test it as soon as the release come and update post header / first topic as solved when next release come and I could test it.
Have a nice day !
|
|
01-22-2014 09:31 AM |
|
KraaxLeNain
Member
|
RE: [Not a bug but a feature] MoveTo find closest destination when unreachable place.
Ok.
I have tested the release and everything works as expected, so I've updated the first post and the title as SOLVED.
QuickQuestion : The "walls" mentioned in the path correspond to mesh border not connected with another mesh (AKA border of the path) right ?
|
|
02-03-2014 11:13 AM |
|
Esenthel
Administrator
|
RE: [Solved] MoveTo find closest destination when unreachable place.
Yes, border of the path mesh.
|
|
02-03-2014 08:48 PM |
|