public static bool IntersectsBounds2D(this Bounds self, Bounds bounds) { var tl = bounds.min; var tr = bounds.min + new Vector3(bounds.size.x, 0, 0); var bl = bounds.min + new Vector3(0, bounds.size.y, 0); var br = bounds.max; return(self.Contains2D(tl) || self.Contains2D(tr) || self.Contains2D(bl) || self.Contains2D(br)); }
/// <summary> /// Check if the bounds contains the given point, ignoring Z. /// </summary> public static bool Contains2D(this Bounds bounds, Vector2 position) { return(bounds.Contains2D((Vector3)position)); }