Pathfinding.RaycastModifier.ValidateLine C# (CSharp) Method

ValidateLine() public method

public ValidateLine ( GraphNode n1, GraphNode n2, Vector3 v1, Vector3 v2 ) : bool
n1 GraphNode
n2 GraphNode
v1 UnityEngine.Vector3
v2 UnityEngine.Vector3
return bool
		public bool ValidateLine (GraphNode n1, GraphNode n2, Vector3 v1, Vector3 v2) {
			
			if (useRaycasting) {
				
				if (thickRaycast && thickRaycastRadius > 0) {
					RaycastHit hit;
					if (Physics.SphereCast (v1+raycastOffset, thickRaycastRadius,v2-v1,out hit, (v2-v1).magnitude,mask)) {
						//Debug.DrawRay (hit.point,Vector3.up*5,Color.yellow);
						return false;
					}
				} else {
					RaycastHit hit;
					if (Physics.Linecast (v1+raycastOffset,v2+raycastOffset,out hit, mask)) {
						//Debug.DrawRay (hit.point,Vector3.up*5,Color.yellow);
						return false;
					}
				}
			}
			
			if (useGraphRaycasting && n1 == null) {
				n1 = AstarPath.active.GetNearest (v1).node;
				n2 = AstarPath.active.GetNearest (v2).node;
			}
			
			if (useGraphRaycasting && n1 != null && n2 != null) {
				
				NavGraph graph = AstarData.GetGraph (n1);
				NavGraph graph2 = AstarData.GetGraph (n2);
				
				if (graph != graph2) {
					return false;
				}
				
				if (graph != null) {
					IRaycastableGraph rayGraph = graph as IRaycastableGraph;
					
					if (rayGraph != null) {
						if (rayGraph.Linecast (v1,v2, n1)) {
							return false;
						}
					}
				}
			}
			return true;
		}
	}