Version: 2017.3

Bounds

struct in UnityEngine

Switch to Manual

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.

Variables

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 Functions

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