Get reachable nodes for a specific cost

Hi there,

I saw that there’s a PathUtilities.GetReachableNodes that will get all the nodes that are reachable from a node. But how do I do if I want to get only the ones I can walk to given a specific cost / distance?

Hi

Indeed there is, it is pro version only though.
See http://arongranberg.com/astar/docs/class_pathfinding_1_1_constant_path.php

Great! I’ve got Pro and I’m using this. However I don’t get it to work. I did this small test:

` IEnumerator Start () {

	ConstantPath p = ConstantPath.Construct (transform.position, 100) as ConstantPath;
	foreach (Node n in p.allNodes) {
		Debug.Break ();
		yield return null;
		Instantiate (GameObject.CreatePrimitive (PrimitiveType.Sphere), (Vector3)n.position, Quaternion.identity);
	}
}

`

And p.allNodes always retrieves 0. Note that I’m extending GridGraph (I’m using a custom graph), and I’m not sure if that’s why it’s not properly working.

Tried with GridGraph. Same results. The previous script is attached to my character (Seeker).

Also, after trying to call to some methods on ConstantPath (after calling Construct), seems that runData is null.

I believe we resolved this over email.

The solution was that ConstantPath is a path type. It needs to be calculated before it is usable, e.g by sending it to a seeker to be calculated, just like normal StartPath calls (including waiting for it to be completed).