A* Pathfinding Project

Movement Points are not accurate on Grid


#1

I’ve been using A* Pro for the last few days to implement a grid based stategy game and something I noticed was if I go onto your TurnBased Hexagon game, if you go to 5 movement points, you can only move 4? Why is this?


image


#2

Hi

The cost between two adjacent nodes is their world distance multiplied by 1000 (though due to a bug this is a bit inaccurate for hexagonal graphs in the current version, this has been fixed in the beta).

For best results I would recommend that you multiply your movement points by the default connection cost. Use

var gg = AstarPath.active.data.gridGraph;
var cost = unitSelected.movementPoints * gg.neighbourCosts[0];

#3

Thank you, I’ll give it a try ASAP :slight_smile:


#4

The solution worked perfectly. Thank you!