public static GetGraph ( |
||
node | ||
return |
public static NavGraph GetGraph (GraphNode node) {
if (node == null) return null;
AstarPath script = AstarPath.active;
if (script == null) return null;
AstarData data = script.astarData;
if (data == null) return null;
if (data.graphs == null) return null;
uint graphIndex = node.GraphIndex;
if (graphIndex >= data.graphs.Length) {
return null;
}
return data.graphs[(int)graphIndex];
}
public Vector3 GetClampedPoint(Vector3 from, Vector3 to, GraphNode hint) { Vector3 point = to; RaycastHit hit; if (useRaycasting && Physics.Linecast(from, to, out hit, mask)) { point = hit.point; } if (useGraphRaycasting && hint != null) { var rayGraph = AstarData.GetGraph(hint) as IRaycastableGraph; if (rayGraph != null) { GraphHitInfo graphHit; if (rayGraph.Linecast(from, point, hint, out graphHit)) { point = graphHit.point; } } } return(point); }