digitsensitive / astar-typescript

A* search algorithm in TypeScript
MIT License
87 stars 18 forks source link

Are x and y swapped in the grid? #16

Closed dpaola2 closed 3 years ago

dpaola2 commented 3 years ago

I'm getting TypeError: undefined is not an object (evaluating 'this.gridNodes[position.y][position.x].getIsWalkable') when I try to call aStarInstance.findPath(...). Looking at that error, it looks like the grid in configuration is reversed - shouldn't x be the first dimension of the array, and y the second dimension?

It's causing some weird behavior in my app and am wondering if this is intentional.

dpaola2 commented 3 years ago

ah, disregard. I understand now.