Show / Hide Table of Contents

    Class BoundsExtensions

    Extension methods for Unity's Bounds struct

    Inheritance
    Object
    BoundsExtensions
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Microsoft.MixedReality.Toolkit
    Assembly: cs.temp.dll.dll
    Syntax
    public static class BoundsExtensions

    Fields

    BCK

    Declaration
    public const int BCK = 5
    Field Value
    Type Description
    Int32

    BOT

    Declaration
    public const int BOT = 1
    Field Value
    Type Description
    Int32

    FWD

    Declaration
    public const int FWD = 4
    Field Value
    Type Description
    Int32

    LB

    Declaration
    public const int LB = 1
    Field Value
    Type Description
    Int32

    LB_LT

    Declaration
    public const int LB_LT = 7
    Field Value
    Type Description
    Int32

    LBB

    Declaration
    public const int LBB = 1
    Field Value
    Type Description
    Int32

    LBF

    Declaration
    public const int LBF = 0
    Field Value
    Type Description
    Int32

    LBF_LBB

    Declaration
    public const int LBF_LBB = 18
    Field Value
    Type Description
    Int32

    LBF_RBF

    Declaration
    public const int LBF_RBF = 9
    Field Value
    Type Description
    Int32

    LFT

    Declaration
    public const int LFT = 2
    Field Value
    Type Description
    Int32

    LT

    Declaration
    public const int LT = 0
    Field Value
    Type Description
    Int32

    LT_RT

    Declaration
    public const int LT_RT = 4
    Field Value
    Type Description
    Int32

    LTB

    Declaration
    public const int LTB = 3
    Field Value
    Type Description
    Int32

    LTB_LBB

    Declaration
    public const int LTB_LBB = 14
    Field Value
    Type Description
    Int32

    LTF

    Declaration
    public const int LTF = 2
    Field Value
    Type Description
    Int32

    LTF_LBF

    Declaration
    public const int LTF_LBF = 12
    Field Value
    Type Description
    Int32

    LTF_LTB

    Declaration
    public const int LTF_LTB = 19
    Field Value
    Type Description
    Int32

    LTF_RTF

    Declaration
    public const int LTF_RTF = 8
    Field Value
    Type Description
    Int32

    RB

    Declaration
    public const int RB = 3
    Field Value
    Type Description
    Int32

    RB_LB

    Declaration
    public const int RB_LB = 6
    Field Value
    Type Description
    Int32

    RBB

    Declaration
    public const int RBB = 5
    Field Value
    Type Description
    Int32

    RBB_LBB

    Declaration
    public const int RBB_LBB = 11
    Field Value
    Type Description
    Int32

    RBF

    Declaration
    public const int RBF = 4
    Field Value
    Type Description
    Int32

    RBF_RBB

    Declaration
    public const int RBF_RBB = 16
    Field Value
    Type Description
    Int32

    RHT

    Declaration
    public const int RHT = 3
    Field Value
    Type Description
    Int32

    RT

    Declaration
    public const int RT = 2
    Field Value
    Type Description
    Int32

    RT_RB

    Declaration
    public const int RT_RB = 5
    Field Value
    Type Description
    Int32

    RTB

    Declaration
    public const int RTB = 7
    Field Value
    Type Description
    Int32

    RTB_LTB

    Declaration
    public const int RTB_LTB = 10
    Field Value
    Type Description
    Int32

    RTB_RBB

    Declaration
    public const int RTB_RBB = 13
    Field Value
    Type Description
    Int32

    RTF

    Declaration
    public const int RTF = 6
    Field Value
    Type Description
    Int32

    RTF_RBF

    Declaration
    public const int RTF_RBF = 15
    Field Value
    Type Description
    Int32

    RTF_RTB

    Declaration
    public const int RTF_RTB = 17
    Field Value
    Type Description
    Int32

    TOP

    Declaration
    public const int TOP = 0
    Field Value
    Type Description
    Int32

    Methods

    CloserToPoint(Bounds, Vector3, Bounds)

    Checks to see whether point is closer to bounds or otherBounds

    Declaration
    public static bool CloserToPoint(this Bounds bounds, Vector3 point, Bounds otherBounds)
    Parameters
    Type Name Description
    Bounds bounds
    Vector3 point
    Bounds otherBounds
    Returns
    Type Description
    Boolean

    ContainsBounds(Bounds, Bounds)

    Checks to see if bounds contains the other bounds completely.

    Declaration
    public static bool ContainsBounds(this Bounds bounds, Bounds otherBounds)
    Parameters
    Type Name Description
    Bounds bounds
    Bounds otherBounds
    Returns
    Type Description
    Boolean

    ExpandToContain(Bounds, Bounds)

    Returns bounds that contain both this bounds and the bounds passed in.

    Declaration
    public static Bounds ExpandToContain(this Bounds originalBounds, Bounds otherBounds)
    Parameters
    Type Name Description
    Bounds originalBounds
    Bounds otherBounds
    Returns
    Type Description
    Bounds

    GetColliderBoundsPoints(Collider, List<Vector3>, LayerMask)

    Method to get bounds from a single Collider

    Declaration
    public static void GetColliderBoundsPoints(Collider collider, List<Vector3> boundsPoints, LayerMask ignoreLayers)
    Parameters
    Type Name Description
    Collider collider

    Target collider

    List<Vector3> boundsPoints

    array reference that gets filled with points

    LayerMask ignoreLayers

    layerMask to simplify search

    GetColliderBoundsPoints(GameObject, List<Vector3>, LayerMask)

    Method to get bounding box points using Collider method.

    Declaration
    public static void GetColliderBoundsPoints(GameObject target, List<Vector3> boundsPoints, LayerMask ignoreLayers)
    Parameters
    Type Name Description
    GameObject target

    gameObject that boundingBox bounds.

    List<Vector3> boundsPoints

    array reference that gets filled with points

    LayerMask ignoreLayers

    layerMask to simplify search

    GetCornerAndMidPointPositions(Bounds, Transform, ref Vector3[])

    Gets all the corner points and mid points from Renderer's Bounds

    Declaration
    public static void GetCornerAndMidPointPositions(this Bounds bounds, Transform transform, ref Vector3[] positions)
    Parameters
    Type Name Description
    Bounds bounds
    Transform transform
    Vector3[] positions

    GetCornerAndMidPointPositions2D(Bounds, Transform, ref Vector3[], BoundsExtensions.Axis)

    Gets all the corner points and mid points from Renderer's Bounds, ignoring the z axis

    Declaration
    public static void GetCornerAndMidPointPositions2D(this Bounds bounds, Transform transform, ref Vector3[] positions, BoundsExtensions.Axis flattenAxis)
    Parameters
    Type Name Description
    Bounds bounds
    Transform transform
    Vector3[] positions
    BoundsExtensions.Axis flattenAxis

    GetCornerPositions(Bounds, Transform, ref Vector3[])

    Gets all the corner points of the bounds in world space by transforming input bounds using the given transform

    Declaration
    public static void GetCornerPositions(this Bounds bounds, Transform transform, ref Vector3[] positions)
    Parameters
    Type Name Description
    Bounds bounds

    Input bounds, in local space

    Transform transform

    Local to world transform

    Vector3[] positions

    Output corner positions

    Remarks

    Use BoxColliderExtensions.{Left|Right}{Bottom|Top}{Front|Back} consts to index into the output corners array.

    GetCornerPositions(Bounds, ref Vector3[])

    Gets all the corner points of the bounds

    Declaration
    public static void GetCornerPositions(this Bounds bounds, ref Vector3[] positions)
    Parameters
    Type Name Description
    Bounds bounds
    Vector3[] positions
    Remarks

    Use BoxColliderExtensions.{Left|Right}{Bottom|Top}{Front|Back} consts to index into the output corners array.

    GetCornerPositionsFromRendererBounds(Bounds, ref Vector3[])

    Gets all the corner points from Renderer's Bounds

    Declaration
    public static void GetCornerPositionsFromRendererBounds(this Bounds bounds, ref Vector3[] positions)
    Parameters
    Type Name Description
    Bounds bounds
    Vector3[] positions

    GetFacePositions(Bounds, Transform, ref Vector3[])

    Declaration
    public static void GetFacePositions(this Bounds bounds, Transform transform, ref Vector3[] positions)
    Parameters
    Type Name Description
    Bounds bounds
    Transform transform
    Vector3[] positions

    GetInvalidBoundsInstance()

    Returns an instance of the 'Bounds' class which is invalid. An invalid 'Bounds' instance is one which has its size vector set to 'float.MaxValue' for all 3 components. The center of an invalid bounds instance is the zero vector.

    Declaration
    public static Bounds GetInvalidBoundsInstance()
    Returns
    Type Description
    Bounds

    GetMeshFilterBoundsPoints(GameObject, List<Vector3>, LayerMask)

    GetMeshFilterBoundsPoints - gets bounding box points using MeshFilter method.

    Declaration
    public static void GetMeshFilterBoundsPoints(GameObject target, List<Vector3> boundsPoints, LayerMask ignoreLayers)
    Parameters
    Type Name Description
    GameObject target

    gameObject that boundingbox bounds

    List<Vector3> boundsPoints

    array reference that gets filled with points

    LayerMask ignoreLayers

    layerMask to simplify search

    GetRenderBoundsPoints(GameObject, List<Vector3>, LayerMask)

    GetRenderBoundsPoints gets bounding box points using Render method.

    Declaration
    public static void GetRenderBoundsPoints(GameObject target, List<Vector3> boundsPoints, LayerMask ignoreLayers)
    Parameters
    Type Name Description
    GameObject target

    gameObject that boundingbox bounds

    List<Vector3> boundsPoints

    array reference that gets filled with points

    LayerMask ignoreLayers

    layerMask to simplify search

    GetScreenRectangle(Bounds, Camera)

    Returns the rectangle which encloses the specifies 'Bounds' instance in screen space.

    Declaration
    public static Rect GetScreenRectangle(this Bounds bounds, Camera camera)
    Parameters
    Type Name Description
    Bounds bounds
    Camera camera
    Returns
    Type Description
    Rect

    GetScreenSpaceCornerPoints(Bounds, Camera)

    Returns the screen space corner points of the specified 'Bounds' instance.

    Declaration
    public static Vector2[] GetScreenSpaceCornerPoints(this Bounds bounds, Camera camera)
    Parameters
    Type Name Description
    Bounds bounds
    Camera camera

    The camera used for rendering to the screen. This is needed to perform the transformation to screen space.

    Returns
    Type Description
    Vector2[]

    IsValid(Bounds)

    Checks if the specified bounds instance is valid. A valid 'Bounds' instance is one whose size vector does not have all 3 components set to 'float.MaxValue'.

    Declaration
    public static bool IsValid(this Bounds bounds)
    Parameters
    Type Name Description
    Bounds bounds
    Returns
    Type Description
    Boolean

    Transform(Bounds, Matrix4x4)

    Transforms 'bounds' using the specified transform matrix.

    Declaration
    public static Bounds Transform(this Bounds bounds, Matrix4x4 transformMatrix)
    Parameters
    Type Name Description
    Bounds bounds

    The 'Bounds' instance which must be transformed.

    Matrix4x4 transformMatrix

    The specified 'Bounds' instance will be transformed using this transform matrix. The function assumes that the matrix doesn't contain any projection or skew transformation.

    Returns
    Type Description
    Bounds

    The transformed 'Bounds' instance.

    Remarks

    Transforming a 'Bounds' instance means that the function will construct a new 'Bounds' instance which has its center translated using the translation information stored in the specified matrix and its size adjusted to account for rotation and scale. The size of the new 'Bounds' instance will be calculated in such a way that it will contain the old 'Bounds'.

    Volume(Bounds)

    Returns the volume of the bounds.

    Declaration
    public static float Volume(this Bounds bounds)
    Parameters
    Type Name Description
    Bounds bounds
    Returns
    Type Description
    Single
    Back to top Generated by DocFX