struct
BBox
public sealed struct BBox An Axis Aligned Bounding Box.
Constructors
Properties
| Name | Type | Description |
|---|---|---|
Corners | IEnumerable<Vector3> | An enumerable that contains all corners of this AABB. |
Center | Vector3 | Calculated center of the AABB. |
Size | Vector3 | Calculated size of the AABB on each axis. |
Extents | Vector3 | The extents of the bbox. This is half the size. |
RandomPointInside | Vector3 | Returns a random point within this AABB. |
RandomPointOnEdge | Vector3 | Returns a random point within this AABB. |
Volume | Single | Returns the physical volume of this AABB. |
Methods
Boolean Contains(BBox b) Returns true if this AABB completely contains given AABB
Boolean Contains(Vector3 b, Single epsilon = 0.0001) Returns true if this AABB contains given point
Boolean Overlaps(BBox b) Returns true if this AABB somewhat overlaps given AABB
BBox Grow(Single skin) Return a slightly bigger box
static BBox FromHeightAndRadius(Single height, Single radius) Creates an AABB of length and depth, and given
static BBox FromPositionAndSize(Vector3 center, Single size = 0) Creates an AABB at given position and given which acts as a diameter of a sphere contained within the AABB.
static BBox FromPositionAndSize(Vector3 center, Vector3 size) Creates an AABB at given position and given a.k.a. "extents".
static BBox FromBoxes(IEnumerable<BBox> boxes) static BBox FromPoints(IEnumerable<Vector3> points, Single size = 0) Boolean Trace(Ray ray, Single distance, Single hitDistance) Trace a ray against this box. If hit then return the distance.
Single GetVolume() Get the volume of this AABB
BBox Snap(Single distance) Snap this AABB to a grid
Single GetEdgeDistance(Vector3 localPos) Calculates the shortest distance from the specified local position to the nearest edge of the shape.
Fields
| Name | Type | Description |
|---|---|---|
Mins | Vector3 | The minimum corner extents of the AABB. Values on each axis should be mathematically smaller than values on the same axis of Maxs. See Sort(Vector3@,Vector3@) |
Maxs | Vector3 | The maximum corner extents of the AABB. Values on each axis should be mathematically larger than values on the same axis of Mins. See Sort(Vector3@,Vector3@) |
Assembly:
Sandbox.System Full Name: BBox