Bounds
An axis-aligned bounding box. It acts as a simple container for a center position and the extents (further subdivided into size, min, max) of a box that can be used for collision detection, visibility testing, or other similar tasks in your game. Unity's Bounds Documentation
Properties
Vector3 value that signifies the central point of the bounding box. Unity's Bounds.center Documentation
Similar to size but it represents half the size of the bounding box in each dimension. This can be used when you need to measure from the center of the bounding box. Unity's Bounds.extents Documentation
The maximal value (upper-right-back corner) of the bounding box coordinates. Unity's Bounds.max Documentation
The minimum value (lower-left-front corner) of the bounding box coordinates. Unity's Bounds.min Documentation
The size of the bounding box for each dimension - how wide, tall, and deep it is. Unity's Bounds.size Documentation
Methods
The closest point on or inside the bounding box to a given point. This can be helpful in figuring out how close an object is to entering a bounding box. Unity's Bounds.ClosestPoint Documentation
Check whether a specific point is within the current bounding box. Unity's Bounds.Contains Documentation
Parameters
point
This is the point which you want to check.
Returns
Returns true if the point is inside the bounding box, false otherwise.
Grows the Bounds to include a point or bounds. You would typically use this when you have a set of points and you want a bounding box that encloses all these points. Unity's Bounds.Encapsulate Documentation
Parameters
bounds
Returns
Grows the Bounds to include a point or bounds. You would typically use this when you have a set of points and you want a bounding box that encloses all these points. Unity's Bounds.Encapsulate Documentation
Parameters
point
The new point to include within the bounding box.
Returns
Checks if two bounding boxes are equal in terms of their center and extents. Unity's Bounds.Equals Documentation
Parameters
other
Returns
Increases the size of the bounding box by the given amount (in both directions). Unity's Bounds.Expand Documentation
Parameters
amount
The amount by which the bounding box should be expanded (shrank if negative).
Returns
Increases the size of the bounding box by the given amount (in both directions). Unity's Bounds.Expand Documentation
Parameters
amount
The amount by which the bounding box should be expanded (shrank if negative).
Returns
Determines if a specified Ray intersects the bounds. This can prove vital in various game scenarios for interaction detection such as determining if a projectile is in range of an object or if a click or tap in screen space intersects a game object. It evaluates the intersection and returns true if the Ray intersects with the bounds, otherwise it returns false. Unity's Bounds.IntersectRay Documentation
Parameters
ray
The Ray instance against which the intersection is to be checked.
Returns
Returns true if the Ray intersects with the bounds, otherwise false.
Checks whether the current bounding box intersects with another bounding box. You can use this to determine if two objects are likely to be colliding. Unity's Bounds.Intersects Documentation
Parameters
bounds
The other bounding box to test intersection with.
Returns
Returns true if the bounding boxes intersect, false otherwise.
The minimum and maximum corners of the bounding box. Unity's Bounds.SetMinMax Documentation
Returns the squared distance from a point to the bounding box. Squared distances can be useful for comparison without needing the computationally expensive square root operation. Unity's Bounds.SqrDistance Documentation
Parameters
point
The point from which the distance is measured.
Returns
Returns the squared distance from the bounding box to the point.
Updated about 19 hours ago