Hi there, Completely new here, just started using A*. It seems like a great toolset. However, i have searched far and wide for exact instructions on how to accomplish connecting runtime generated graphs, and had no success.
I noted that there is an article here about this topic, but in both threads i could locate, there seems to be key code missing that left me in the dark. For eg: in the following snippet… GetGraphAtChunk()… Im assuming this is a custom method, as i could not locate the method myself.
Im really struggling to make this work, as its one of the last things i need to complete. But alas, no success at all.
void AddGridGraph(int chunkX, int chunkZ) {
...
// z = 0
for (int x = 0; x < graph.width; x++) {
var node = graph.GetNode(x, 0);
var adjacentGraph = GetGraphAtChunk(chunkX, chunkZ-1);
var adjacentNode = adjacentGraph.GetNode(x, adjacentGraph.depth - 1);
var cost = (adjacentNode.position - node.position).CostMagnitude;
node.AddConnection(adjacentNode, cost);
adjacentNode.AddConnection(node, cost);
}
// Similar code for the 4 other edges of the graph
}
On topic, I have several very small graphs (5 x 5 nodes each), that i need to connect after they have been generated at runtime. But yes, i have no clue what to do at this point. Any help would be so great, so so great. ty.