Support Forum

Path Position Issue

I’m trying to get a path for a Grid Graph using AstarPath.StartPath, but it is returning very large positions (Path.path[index].position). Node size is 1 on a 10 by 10 grid and a search from 0,0,0 to 1,1,0 returns the following path list:


I was hoping for something like this:



Node positions are stored as integer coordinates in millimeters. You can convert them to regular Vector3 coordinates using a cast.

Vector3 p = (Vector3)node.position;

You can also access their indices in the grid:

var gridNode = node as GridNodeBase;
int x = gridNode.XCoordinateInGrid;
int z = gridNode.ZCoordinateInGrid;