Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Bounds

Represents an axis aligned bounding box.
Read time 1 minuteLast updated 4 days ago

Definition

public struct Bounds : IEquatable<Bounds>, IFormattable

Remarks

An axis-aligned bounding box, or AABB for short, is a box aligned with coordinate axes and fully enclosing some object. Because the box is never rotated with respect to the axes, it can be defined by just its Bounds.center and Bounds.extents, or alternatively by Bounds.min and Bounds.max points.

Constructors

Constructor

Description

Bounds(UnityEngine.Vector3,UnityEngine.Vector3)Creates a new Bounds.

Properties

Property

Description

centerThe center of the bounding box.
extentsThe extents of the Bounding Box. This is always half of the Bounds.size of the Bounds.
maxThe maximal point of the box. This is always equal to center+extents.
minThe minimal point of the box. This is always equal to center-extents.
sizeThe total size of the box. This is always twice as large as the Bounds.extents.

Methods

Method

Description

ClosestPointThe closest point on the bounding box.
ContainsIs point contained in the bounding box?
EncapsulateGrow the bounds to encapsulate the bounds.
ExpandExpand the bounds by increasing its size by amount along each side.
IntersectRayDoes ray intersect this bounding box?
IntersectsDoes another bounding box intersect with this bounding box?
SetMinMaxSets the bounds to the min and max value of the box.
SqrDistanceThe smallest squared distance between the point and this bounding box.
ToStringReturns a formatted string for the bounds.