Copyright VirtualSim 2004-2020 - All rights reserved
Cost Function
Path finding algorithm (PathFinding component) use a cost function.
The user can change the default cost function as needed. Parameters are specified in the comments.
The value returned by the function is unit less. What only matters is the value itself compared to others. Returning a low cost will increase chance for the path-finding algorithm to keep the node while returning a high cost will probably end up with a rejection of the cell.
In the cost function, not only can you query the cell tag, but also the cells around it or even the entity location or attributes (getting too far from a destination, etc.)
The cost function is the most important part of the algorithm and the more sensitive.
User Code
Enter here the cost function that will return the arbitrary value of the node, according to any kind of conditions.
What is important is not the value itself but its ranking regarding the other node values for the same mesh and for one path search (per entity).
The function must return the cost of moving from the nodef to the nodet for the entity ent.
The lower the value, the more chance to be selected by the path finding algorithm. The higher the value, the more chance to be rejected.