Pathfinding.GraphUpdateScene.GetBounds C# (CSharp) Method

GetBounds() public method

public GetBounds ( ) : Bounds
return UnityEngine.Bounds
		public Bounds GetBounds () {
			
			Bounds b;
			
			if (points == null || points.Length == 0) {
				if (collider != null) b = collider.bounds;
				else if (renderer != null) b = renderer.bounds;
				else {
					//Debug.LogWarning ("Cannot apply GraphUpdateScene, no points defined and no renderer or collider attached");
					return new Bounds(Vector3.zero, Vector3.zero);
				}
			} else {
				Matrix4x4 matrix = Matrix4x4.identity;
				
				if (!useWorldSpace) {
					matrix = transform.localToWorldMatrix;
				}
				
				Vector3 min = matrix.MultiplyPoint3x4(points[0]);
				Vector3 max = matrix.MultiplyPoint3x4(points[0]);
				for (int i=0;i<points.Length;i++) {
					Vector3 p = matrix.MultiplyPoint3x4(points[i]);
					min = Vector3.Min (min,p);
					max = Vector3.Max (max,p);
				}
				
				b = new Bounds ((min+max)*0.5F,max-min);
			}
			
			if (b.size.y < minBoundsHeight) b.size = new Vector3(b.size.x,minBoundsHeight,b.size.z);
			return b;
		}