Closest node function to AstarFinder.js#127
Closest node function to AstarFinder.js#127Fralleee wants to merge 1 commit intoqiao:masterfrom Fralleee:patch-6
Conversation
If end node can't be reached, get path to nearest open node.
|
How about this takes a second argument or something and rather than "nearest" node it gets to a node within proximity? It could default to nearest but could be used to make more strategic moves if necessary. |
|
But isn't nearest open node the same as node within proximity? Implemented this function to my RTS game so the characters would still path closeby if you clicked on obstacles. That was the intended use and the only one I could think of at the moment. |
|
Cool! I'm using this for a turn based combat system so maybe my use case is slightly different but consider this; what if threat is like cost? So a move to nearest node might also take threat into consideration and instead move them within proximity for defensive positioning rather than get them as close as possible to the original destination. I've kind of already implemented this but it's pretty specific for my use case, would be good to have a more general solution. |
If end node can't be reached, get path to nearest open node.