Bounds
Represents an axis aligned bounding box.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Struct
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
- Implements: IEquatable<Bounds>, IFormattable
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 |
|---|---|
| center | The center of the bounding box. |
| extents | The extents of the Bounding Box. This is always half of the Bounds.size of the Bounds. |
| max | The maximal point of the box. This is always equal to center+extents. |
| min | The minimal point of the box. This is always equal to center-extents. |
| size | The total size of the box. This is always twice as large as the Bounds.extents. |
Methods
Method | Description |
|---|---|
| ClosestPoint | The closest point on the bounding box. |
| Contains | Is point contained in the bounding box? |
| Encapsulate | Grow the bounds to encapsulate the bounds. |
| Expand | Expand the bounds by increasing its size by amount along each side. |
| IntersectRay | Does ray intersect this bounding box? |
| Intersects | Does another bounding box intersect with this bounding box? |
| SetMinMax | Sets the bounds to the min and max value of the box. |
| SqrDistance | The smallest squared distance between the point and this bounding box. |
| ToString | Returns a formatted string for the bounds. |