![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | eod |
I’ve built a small tilemap, each tile is 64px by 64px.
I’ve built an AStar, with each point connected to it’s neighbor, including it’s diagonal neighbor.
Bidirection movement between points is enabled.
I have set weights for each point.
Here’s my default tilemap:
- Weights are shown
- “x” is my character
I want to move my character 2 tiles down, here’s the “best path” AStar detects:
Here’s the path it should take because the weight is cheaper
- e.g. above AStar path is: 4+3=7; this path is: 3+3=6
–
The AStar works well everywhere else, and I’ve narrowed down this issue to only when a better path involves diagonal movement. From there, I’m deducing that AStar must be saying that going from the x → 3 tile is longer (pixels/offset) than going from the x → 4 tile. Therefore AStar chooses the later even though the weight is more expensive.
Does this conclusion seem correct? If yes, How do I adjust the AStar to go strictly off weights and not distances (pixels/offset) so I can get the desire path of: x → 3 → 3 show above?