BBoxclass

An Axis Aligned Bounding Box.

objectBBox
Namespace
global
Assembly
Sandbox.System
Declaration
public sealed struct BBox

Constructors2

Showing 2 constructors

Methods19

Showing 19 methods

public BBox AddBBox(BBox point)PUBLIC

Returns this bbox but stretched to include given bbox

ParameterTypeDescription
pointBBox
Returns:BBox

public BBox AddPoint(Vector3 point)PUBLIC

Returns this bbox but stretched to include given point

ParameterTypeDescription
pointVector3
Returns:BBox

public Vector3 ClosestPoint(Vector3 point)PUBLIC

Returns the closest point on this AABB to another point

ParameterTypeDescription
pointVector3
Returns:Vector3

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

ParameterTypeDescription
boxesIEnumerable<BBox>
Returns:BBox

public static BBox FromHeightAndRadius(float height, float radius)PUBLICSTATIC

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

ParameterTypeDescription
heightfloat
radiusfloat
Returns:BBox

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

ParameterTypeDescription
pointsIEnumerable<Vector3>
size = 0float
Returns:BBox

public float GetEdgeDistance(Vector3 localPos)PUBLIC

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

ParameterTypeDescription
localPosVector3
Returns:float

public float GetVolume()PUBLICOBSOLETE

Get the volume of this AABB

Obsolete: Use BBox.Volume instead.

Returns:float

public BBox Grow(float skin)PUBLIC

Return a slightly bigger box

ParameterTypeDescription
skinfloat
Returns:BBox

public bool Overlaps(BBox b)PUBLIC

Returns true if this AABB somewhat overlaps given AABB

ParameterTypeDescription
bBBox
Returns:bool

public BBox Rotate(Rotation rotation)PUBLIC

Rotate this box by this amount and return

ParameterTypeDescription
rotationRotation
Returns:BBox

public BBox Snap(float distance)PUBLIC

Snap this AABB to a grid

ParameterTypeDescription
distancefloat
Returns:BBox

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

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

ParameterTypeDescription
rayRay
distancefloat
hitDistancefloat
Returns:bool

public BBox Translate(Vector3 point)PUBLIC

Move this box by this amount and return

ParameterTypeDescription
pointVector3
Returns:BBox

Properties7

Showing 7 properties

public Vector3 BBox.Center { get; set; }PUBLICGETSET

Calculated center of the AABB.

Returns:Vector3

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

An enumerable that contains all corners of this AABB.

Returns:IEnumerable<Vector3>

public Vector3 BBox.Extents { get; set; }PUBLICGETSET

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

Returns:Vector3

public Vector3 BBox.RandomPointInside { get; set; }PUBLICGETSET

Returns a random point within this AABB.

Returns:Vector3

public Vector3 BBox.RandomPointOnEdge { get; set; }PUBLICGETSET

Returns a random point within this AABB.

Returns:Vector3

public Vector3 BBox.Size { get; set; }PUBLICGETSET

Calculated size of the AABB on each axis.

Returns:Vector3

public float BBox.Volume { get; set; }PUBLICGETSET

Returns the physical volume of this AABB.

Returns:float

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