Class BoundingBoxHelper
The BoundingBoxHelper class contains functions for getting geometric info from the non-axis-aligned bounding box of a GameObject. These functions can be used to align another object to the center of a certain face or the center of an edge of a face... etc. The BoundingBoxHelper static function can be used for a one time calculation. The dynamic functions can be used to obtain boundingcube info on an object's Update loop. Operations are minimized in the dynamic use scenario.
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.UI
Assembly: cs.temp.dll.dll
Syntax
public class BoundingBoxHelper
Methods
GetFaceBottomCentroid(Int32)
Get the center of the bottom edge of a face of the bounding box determined by index
Declaration
public Vector3 GetFaceBottomCentroid(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | parameter indicating which face is used. 0-5 |
Returns
Type | Description |
---|---|
Vector3 | a vector representing the bottom most edge center of the face |
GetFaceCentroid(Int32)
This function returns the centroid of a face of the bounding cube of an object specified by the index parameter;
Declaration
public Vector3 GetFaceCentroid(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | an index into the list of faces of a boundingcube. 0-5 |
Returns
Type | Description |
---|---|
Vector3 |
GetFaceCorners(Int32)
This function returns the four corners of a face of a bounding cube specified by index.
Declaration
public Vector3[] GetFaceCorners(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | the index of the face of the bounding cube. 0-5 |
Returns
Type | Description |
---|---|
Vector3[] | an array of 4 vectors |
GetFaceEdgeMidpoints(Int32)
This function returns the midpoints of each of the edges of the face of the bounding box
Declaration
public Vector3[] GetFaceEdgeMidpoints(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | the index of the face of the bounding cube- 0-5 |
Returns
Type | Description |
---|---|
Vector3[] | four Vector3 points |
GetFaceIndices(Int32)
this function gets the indices of the bounding cube corners that make up a face.
Declaration
public int[] GetFaceIndices(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | the face index of the bounding cube 0-5 |
Returns
Type | Description |
---|---|
Int32[] | an array of four integer indices |
GetFaceNormal(Int32)
Get the normal of the face of the bounding cube specified by index
Declaration
public Vector3 GetFaceNormal(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | the index of the face of the bounding cube 0-5 |
Returns
Type | Description |
---|---|
Vector3 | a vector3 representing the face normal |
GetIndexOfForwardFace(Vector3)
This function gets the index of the face of the bounding cube that is most facing the lookAtPoint. This could be the headPosition or camera position if the face that was facing the view is desired.
Declaration
public int GetIndexOfForwardFace(Vector3 lookAtPoint)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | lookAtPoint | the world coordinate to test which face is desired |
Returns
Type | Description |
---|---|
Int32 | an integer representing the index of the bounding box faces |
GetRawBBCorners(BoundingBox)
This function gets the untransformed bounding box corner points of a GameObject.
Declaration
public void GetRawBBCorners(BoundingBox boundingBox)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | boundingBox |
GetUntransformedCornersFromObject(BoxCollider, List<Vector3>)
static function that performs one-time non-persistent calculation of boundingbox of object without transformation.
Declaration
public static void GetUntransformedCornersFromObject(BoxCollider targetBounds, List<Vector3> boundsPoints)
Parameters
Type | Name | Description |
---|---|---|
BoxCollider | targetBounds | |
List<Vector3> | boundsPoints | the array of 8 points that will be filled |
UpdateNonAABoundingBoxCornerPositions(BoundingBox, List<Vector3>)
Objects that align to an target's bounding box can call this function in the object's UpdateLoop to get current bound points;
Declaration
public void UpdateNonAABoundingBoxCornerPositions(BoundingBox boundingBox, List<Vector3> boundsPoints)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | boundingBox | |
List<Vector3> | boundsPoints |