Open Yonaba opened 10 years ago
Hello, was this feature added? I can't find it in the pathfinder.lua script, also "myFinder:setTunnelling(false)" doesn't work. Have you abandoned this project? or am I missing something? I'm not very good at algorithms and I don't fully understand this framework, I'm unable to add it myself.
When diagonal moves are allowed, an agent when turning around a corner (wall edge) can cross the corner. This behaviour might not be suitable for some games, as it results in unaesthetic paths, especially for agents having a certain size. Although it can be solved with clearance, we shoud be able to allow/disallow the ability to cross a corner when making a diagonal move.
This can be easily implemented by skipping an adjacent neighbor when getting the list of a node neighbors. Assuming
dx
anddy
are the normalized vectors of movement, we check if the node at (currentNode.x+dx, currentNode.y) is walkable. In case it is, we only add it to the list of neighbors ifcornerCrossing
is allowed.The ability to
(dis)allowCornerCrossing
will be added as a new method to thepathfinder
interface.