Vector3 Center { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Center property of the BBox struct provides the calculated center point of the Axis Aligned Bounding Box (AABB). This property is useful for determining the midpoint of the bounding box in 3D space.

Usage

To access the center of a bounding box, simply use the Center property on an instance of BBox. This property is read-only and automatically calculated based on the minimum and maximum extents of the bounding box.

Example

// Example of accessing the Center property of a BBox
BBox boundingBox = new BBox(new Vector3(0, 0, 0), new Vector3(10, 10, 10));
Vector3 center = boundingBox.Center;

// Output the center
// center should be (5, 5, 5) since it's the midpoint between the mins and maxs
Debug.Log($"Center of the bounding box: {center}");