Version: 2019.3
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 nicely formatted string for the bounds.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961