s&box docs

public sealed struct BBox

An Axis Aligned Bounding Box.

Broader workflow and conceptual references connected to this API.

Constructors

Showing 2 constructors

Methods

Showing 19 methods

public BBox AddBBox(BBox point)

Returns this bbox but stretched to include given bbox

public BBox AddPoint(Vector3 point)

Returns this bbox but stretched to include given point

public Vector3 ClosestPoint(Vector3 point)

Returns the closest point on this AABB to another point

public static BBox FromBoxes(System.Collections.Generic.IEnumerable`1<BBox> boxes)

public static BBox FromHeightAndRadius(float height, float radius)

Creates an AABB of `radius` length and depth, and given `height`

public static BBox FromPoints(System.Collections.Generic.IEnumerable`1<Vector3> points, float size = 0)

Parameters

  • size: Default: 0

public float GetEdgeDistance(Vector3 localPos)

Calculates the shortest distance from the specified local position to the nearest edge of the shape.

public float GetVolume()Obsolete

Get the volume of this AABB

Obsolete: Use BBox.Volume instead.

public BBox Grow(float skin)

Return a slightly bigger box

public bool Overlaps(BBox b)

Returns true if this AABB somewhat overlaps given AABB

public BBox Rotate(Rotation rotation)

Rotate this box by this amount and return

public BBox Snap(float distance)

Snap this AABB to a grid

public bool Trace(Ray ray, float distance, float hitDistance)

Trace a ray against this box. If hit then return the distance.

public BBox Translate(Vector3 point)

Move this box by this amount and return

Properties

Showing 7 properties

public Vector3 BBox.Center { get; set; }

Calculated center of the AABB.

public System.Collections.Generic.IEnumerable`1<Vector3> BBox.Corners { get; set; }

An enumerable that contains all corners of this AABB.

public Vector3 BBox.Extents { get; set; }

The extents of the bbox. This is half the size.

public Vector3 BBox.RandomPointInside { get; set; }

Returns a random point within this AABB.

public Vector3 BBox.RandomPointOnEdge { get; set; }

Returns a random point within this AABB.

public Vector3 BBox.Size { get; set; }

Calculated size of the AABB on each axis.

public float BBox.Volume { get; set; }

Returns the physical volume of this AABB.

Metadata

FieldValue
Namespaceglobal
Typeclass
AssemblySandbox.System
Doc IDT:BBox

On this page

Constructorspublic BBox(Vector3 center, System.Single size = 0)public BBox(Vector3 mins, Vector3 maxs)Methodspublic BBox AddBBox(BBox point)public BBox AddPoint(Vector3 point)public Vector3 ClosestPoint(Vector3 point)public System.Boolean Contains(BBox b)public System.Boolean Contains(Vector3 b, System.Single epsilon = 0.0001)public static BBox FromBoxes(System.Collections.Generic.IEnumerable`1<BBox> boxes)public static BBox FromHeightAndRadius(System.Single height, System.Single radius)public static BBox FromPoints(System.Collections.Generic.IEnumerable`1<Vector3> points, System.Single size = 0)public static BBox FromPositionAndSize(Vector3 center, Vector3 size)public static BBox FromPositionAndSize(Vector3 center, System.Single size = 0)public System.Single GetEdgeDistance(Vector3 localPos)public System.Single GetVolume()public BBox Grow(System.Single skin)public System.Boolean Overlaps(BBox b)public BBox Rotate(Rotation rotation)public BBox Snap(System.Single distance)public System.Boolean Trace(Ray ray, System.Single distance, System.Single hitDistance)public BBox Transform(Transform transform)public BBox Translate(Vector3 point)Propertiespublic Vector3 BBox.Center { get; set; }public System.Collections.Generic.IEnumerable`1<Vector3> BBox.Corners { get; set; }public Vector3 BBox.Extents { get; set; }public Vector3 BBox.RandomPointInside { get; set; }public Vector3 BBox.RandomPointOnEdge { get; set; }public Vector3 BBox.Size { get; set; }public System.Single BBox.Volume { get; set; }Metadata