Version: Unity 6.1 Alpha (6000.1)
LanguageEnglish
  • C#

Bounds

struct in UnityEngine

/

Implemented in:UnityEngine.CoreModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Represents an axis aligned bounding box.

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 center and extents, or alternatively by min and max points.

Bounds is used by Collider.bounds, Mesh.bounds and Renderer.bounds.

Properties

centerThe center of the bounding box.
extentsThe extents of the Bounding Box. This is always half of the 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 extents.

Constructors

BoundsCreates a new Bounds.

Public Methods

ClosestPointThe closest point on the bounding box.
ContainsIs point contained in the bounding box?
EncapsulateGrows the Bounds to include the point.
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.