Jumper icon indicating copy to clipboard operation
Jumper copied to clipboard

(dis)allow corner crossing in diagonal mode

Open Yonaba opened this issue 10 years ago • 1 comments

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 and dy 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 if cornerCrossing is allowed.

The ability to (dis)allowCornerCrossing will be added as a new method to the pathfinder interface.

Yonaba avatar Jun 04 '14 12:06 Yonaba

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.

Abdo023 avatar Mar 05 '18 00:03 Abdo023