Closed tapio closed 11 years ago
Thanks for the suggestion. I will implement it in the near future :)
I dont know how much u wanna mess up with the code, but in src / core /grid.js theres a function called getNeighbors that handles the whole diagonal stuff. Maybe u should try adding some extra conditions there.
Em 06/11/2012 11:51, "Tapio Vierros" notifications@github.com escreveu:
Hello, I have a world which is based on a grid, but the characters roam freely in it. As such, I'd like to allow diagonal movement for the path finding, but not when it would cut over a corner. Below are pictures illustrating this:
Cutting corners:
Avoiding corner cutting:
Of course this should be optional. I think it could be added to the Grid fairly easily. Depending on how the pathfinding algorithms are implemented, perhaps in isWalkableAt or getNeightbours.
Here's a reference implementation of it for a different AStar pathfinder: link.
— Reply to this email directly or view it on GitHub.
Hello, I have a world which is based on a grid, but the characters roam freely in it. As such, I'd like to allow diagonal movement for the path finding, but not when it would cut over a corner. Below are pictures illustrating this:
Cutting corners:![Cutting corners](http://i.imgur.com/wTGew.png)
Avoiding corner cutting:![Avoiding corner cutting](http://i.imgur.com/m7n3u.png)
My use case: a robot which is not infinitely thin cannot cut corners:![Use case](http://i.imgur.com/oHfqd.jpg)
Of course this should be optional. I think it could be added to the
Grid
fairly easily. Depending on how the pathfinding algorithms are implemented, perhaps inisWalkableAt
orgetNeightbours
.Here's a reference implementation of it for a different AStar pathfinder: link.