How to get a nodes x and y position in a gridgraph

Hi,
I am trying to use the Bresenham line algorithm to do basic visibility checks, assuming that if a node is not walkable then it is also opaque. To achieve this however, I need to know the current grid x and y position of a node. Can you tell me how to find a gridnode’s x and y position in the grid, or perhaps is there a better way to tell if there are any nodes between 2 points that are not walkable?

thanks

Hi

This is already a built-in function.
You can use the GridGraph.Linecast method.

See https://arongranberg.com/astar/docs/class_pathfinding_1_1_grid_graph.php#ab198ba7b7d8279378465cddcca43d51f

GridGraph gg = AstarPath.active.data.gridGraph;
bool anyObstacleInTheWay = gg.Linecast(from, to);

Thanks man, that is what i needed.