Description
The RandomPointInside
property of the BBox
struct returns a random point within the axis-aligned bounding box (AABB). This property is useful for generating random positions within a defined 3D space, which can be particularly helpful in scenarios such as spawning objects or particles within a bounded area.
Usage
To use the RandomPointInside
property, simply access it from an instance of BBox
. The property will return a Vector3
representing a random point inside the bounding box.
Example
// Example of using RandomPointInside
BBox boundingBox = new BBox(new Vector3(0, 0, 0), new Vector3(10, 10, 10));
Vector3 randomPoint = boundingBox.RandomPointInside;
// randomPoint now contains a random position within the bounding box defined by (0,0,0) and (10,10,10)