Hi. I am currently developing a game based on the Xcom mechanics. I bought the Pro version because it allows multiple level grids. I need a way to show the selected player character how far they can run with the current action points. So I need a way to draw an outline around all reachable gridnodes.
This function seems to do exactly what I need. I tried to put this in, but I can’t get it to work. I don’t know how to get the list. Can someone give me an example of this? The seeker does not return anything.
Additionally: How do I use the allNodes list to make a drawing from it?
, but I cant verify it. The SampleScene doesnt work with the functions I want to test *Constant Path and FloodPath@. See Video. I’m using the current Beta by the Way.
// Here you create a new path and set how far it should search. Null is for the callback, but the seeker will handle that
ConstantPath cpath = ConstantPath.Construct(transform.position, 2000, null);
// Request the seeker to search for the path
seeker.StartPath(cpath, null);
cpath.BlockUntilCalculated();
for (int i = 0; i < cpath.allNodes.Count; i++) {
Debug.DrawRay((Vector3)cpath.allNodes[i].position, Vector3.up, Color.red, 2);
}
Ah, yes. That is from the movement script which gets confused about why you’d want to send a ConstantPath to it (makes no sense to follow such a path type). The AIPath script listens to all path requests completed by an attached Seeker.
You can use the AstarPath component directly to avoid this:
// Here you create a new path and set how far it should search. Null is for the callback, but the seeker will handle that
ConstantPath cpath = ConstantPath.Construct(transform.position, 2000, null);
// Request the seeker to search for the path
AstarPath.StartPath(cpath);
cpath.BlockUntilCalculated();
for (int i = 0; i < cpath.allNodes.Count; i++) {
Debug.DrawRay((Vector3)cpath.allNodes[i].position, Vector3.up, Color.red, 2);
}
Thank you so much! This is a huge milestone for me
I instantiated an object at every position with your code. Works flawlessly. Now I unly need to understand how the score is calculated, but I’m sure, I can find it out pretty easily.