August 2018
Beginner
334 pages
10h 19m
English
We will learn how to modify the current Dijkstra algorithm in order to approach the problem using pre-processing techniques and optimizing the path-finding time. It can be seen as three big steps—modifying the main algorithm, creating the pre-processing function (handy in editor mode, for example), and, finally, defining the path retrieval function:
public int[] Dijkstra(GameObject srcObj)
return previous;
if (ReferenceEquals(node.vertex, dst))
{
return BuildPath(src.id, node.vertex.id, ref previous);
}
Also, delete the following line at the beginning:
Vertex dst = GetNearestVertex(dstObj.transform.position); ...
Read now
Unlock full access