Function GridStringPulling.Calculate

Calculate (List<GraphNode> pathNodes, int nodeStartIndex, int nodeEndIndex, Vector3 startPoint, Vector3 endPoint, refTraversalCosts traversalCosts, refTraversalConstraint traversalConstraint, int maxCorners=…)

Simplifies a path on a grid graph using a string pulling algorithm.

Public Static
List<Vector3> Calculate (

List<GraphNode>

pathNodes

A list of input nodes. Only the slice of nodes from nodeStartIndex to nodeEndIndex (inclusive) will be used. These must all be of type GridNodeBase and must form a path (i.e. each node must be a neighbor to the next one in the list).

int

nodeStartIndex

The index in pathNodes to start from.

int

nodeEndIndex

The last index in pathNodes that is used.

Vector3

startPoint

A more exact start point for the path. This should be a point inside the first node (if not, it will be clamped to the node's surface).

Vector3

endPoint

A more exact end point for the path. This should be a point inside the first node (if not, it will be clamped to the node's surface).

refTraversalCosts

traversalCosts

Can be used to specify how much it costs to traverse each node. Sometimes the geometrically shortest path is not the best path. The algorithm will still discard any simplifications which don't make the path less costly.

refTraversalConstraint

traversalConstraint

Can be used to prevent the linecast from traversing some nodes. Use TraversalConstraint.None to not apply any constraints. It is assumed that all nodes in pathNodes pass this filter.

int

maxCorners=int.MaxValue

If you only need the first N points of the result, you can specify that here, to avoid unnecessary work.

)

Simplifies a path on a grid graph using a string pulling algorithm.

See the class documentation for more details.