Pathfinding.BBTreeBox.BBTreeBox C# (CSharp) Method

BBTreeBox() public method

public BBTreeBox ( BBTree tree, Pathfinding.MeshNode node ) : System
tree BBTree
node Pathfinding.MeshNode
return System
		public BBTreeBox (BBTree tree, MeshNode node) {
			this.node = node;
			Vector3 first = (Vector3)node.GetVertex(0);
			Vector2 min = new Vector2(first.x,first.z);
			Vector2 max = min;
			
			for (int i=1;i<node.GetVertexCount();i++) {
				Vector3 p = (Vector3)node.GetVertex(i);
				min.x = Mathf.Min (min.x,p.x);
				min.y = Mathf.Min (min.y,p.z);
				
				max.x = Mathf.Max (max.x,p.x);
				max.y = Mathf.Max (max.y,p.z);
			}
			
			rect = Rect.MinMaxRect (min.x,min.y,max.x,max.y);
		}