Function TraversalConstraint.ToNearestNodeConstraint

ToNearestNodeConstraint ()

A nearest node constraint which uses the same settings as this traversal constraint.

Public
NearestNodeConstraint ToNearestNodeConstraint ()

A nearest node constraint which uses the same settings as this traversal constraint.

var nearestNodeConstraint = traversalConstraint.ToNearestNodeConstraint();

// Use the nearest node constraint to find the closest node
var nearest = AstarPath.active.GetNearest(transform.position, nearestNodeConstraint);