Hey, i want to add the nodelink costfactor to cost, how can i do this? please update the script. using gridgraph.
uint GetCost(ABPath path)
{
uint cost = 0;
for (int i = 0; i < path.path.Count - 1; i++)
{
var node = path.path[i];
//var nextNode = path.path[i + 1];
cost += path.GetTraversalCost(node);
}
// Add the cost for the last node
if (path.path.Count > 0)
{
cost += path.GetTraversalCost(path.path[path.path.Count - 1]);
}
// Add the cost for the total length
cost += (uint)(path.GetTotalLength() * Int3.Precision);
return cost;
}
thanks