Having trouble using GetPointsAroundPoint

Hi, I just recently downloaded the demo version and so far I’m very impressed and love it. Right now I’m trying to generate points around a target location with GetPointsAroundPoint using a grid graph. Since I’m only using one graph the documentation says to use AstarPath.active.graphs[0] as IRaycastableGraph, but when I try that it returns null and GetPointsAroundPoint throws its exception due to having a null IRaycastableGraph.

Any insight would be appreciated, thanks!

Hi

Are you sure the graphs are scanned when you try this?

Also, you can use

var graph = AstarPath.active.astarData.gridGraph;

to get the first grid graph in the scene.

Note that the point graph does not implement IRaycastableGraph since there is no sensible way to run raycasts on it.

I’m pretty sure my graph is scanned? If I just have it print(AstarPath.active.graphs[0].name); I get the name of my graph in the scene, but when I do

var graph = AstarPath.active.graph[0] as IRaycastableGraph;
print(graph);

the output is null.

I’m using a grid graph, not a point graph.

I can paste the exact code in later if that would help. I’m at work right now and it’s a project I work on in the mornings before work so I don’t have the code in front of me at this moment.

Thanks for the help!

Oh, right. You are using the free version.
Raycasts on a grid graph are only available in the pro version (as mentioned by http://arongranberg.com/astar/freevspro and the docs here http://arongranberg.com/astar/docs/class_pathfinding_1_1_grid_graph.php#a94692fe658e5961985f692dd1f10b3e9).

You can use http://arongranberg.com/astar/docs/class_pathfinding_1_1_path_utilities.php#a4ed81975cfd7647cae1e6fd0d0be8f69
together with http://arongranberg.com/astar/docs/class_pathfinding_1_1_path_utilities.php#a9be5af0e79b81927648f7677c29d9833
to get a similar result.

1 Like

Awesome! I’ll take a better look at that once I get home. Thank you for being so helpful.

Hey I’m having this exact problem, but the links you are suggesting to point to anything. May I ask what functions you are referring to? I need to get nodes around a central point or node, but BFS only returns walkable nodes (I think), and I need unwalkable nodes as well.

thanks