日本語翻訳ドキュメントはサポートを終了しました

MRTK 2.6 以降のドキュメントについては、公式の Microsoft ドキュメント を参照してください。

    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

    DebugDraw(Bounds, Color, Single, Boolean)

    Draws a wire frame Bounds object using Debug.DrawLine.

    Declaration
    public static void DebugDraw(this Bounds bounds, Color color, float duration = 0F, bool depthTest = true)
    Parameters
    Type Name Description
    Bounds bounds

    The Bounds to draw.

    Color color

    Color of the line.

    Single duration

    How long the line should be visible for in seconds.

    Boolean depthTest

    Should the line be obscured by objects closer to the camera?

    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

    GetColliderBounds(GameObject, out Bounds, LayerMask)

    Method to get bounds using collider method.

    Declaration
    public static bool GetColliderBounds(GameObject target, out Bounds bounds, LayerMask ignoreLayers)
    Parameters
    Type Name Description
    GameObject target

    GameObject to generate the bounds around.

    Bounds bounds

    An AABB in world space around all the colliders in a gameObject hierarchy.

    LayerMask ignoreLayers

    A LayerMask to restrict the colliders selected.

    Returns
    Type Description
    Boolean

    True if bounds were calculated, if zero colliders are present bounds will not be calculated.

    GetColliderBoundsPoints(Collider, List<Vector3>, LayerMask, Transform)

    Method to get bounds from a single Collider

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

    Target collider

    List<Vector3> boundsPoints

    array reference that gets filled with points

    LayerMask ignoreLayers

    layerMask to simplify search

    Transform relativeTo

    GetColliderBoundsPoints(GameObject, List<Vector3>, LayerMask, Transform)

    Method to get bounding box points using Collider method.

    Declaration
    public static void GetColliderBoundsPoints(GameObject target, List<Vector3> boundsPoints, LayerMask ignoreLayers, Transform relativeTo = null)
    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

    Transform relativeTo

    compute bounds relative to this transform

    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

    GetMeshFilterBounds(GameObject, out Bounds, LayerMask)

    Method to get bounds using mesh filters method.

    Declaration
    public static bool GetMeshFilterBounds(GameObject target, out Bounds bounds, LayerMask ignoreLayers)
    Parameters
    Type Name Description
    GameObject target

    GameObject to generate the bounds around.

    Bounds bounds

    An AABB in world space around all the mesh filters in a GameObject hierarchy.

    LayerMask ignoreLayers

    A LayerMask to restrict the colliders selected.

    Returns
    Type Description
    Boolean

    True if bounds were calculated, if zero mesh filters are present bounds will not be calculated.

    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

    GetPointsBounds(List<Vector3>, out Bounds)

    Method to get bounds from a collection of points.

    Declaration
    public static bool GetPointsBounds(List<Vector3> points, out Bounds bounds)
    Parameters
    Type Name Description
    List<Vector3> points

    The points to construct a bounds around.

    Bounds bounds

    An AABB in world space around all the points.

    Returns
    Type Description
    Boolean

    True if bounds were calculated, if zero points are present bounds will not be calculated.

    GetRenderBounds(GameObject, out Bounds, LayerMask)

    Method to get bounds using renderer method.

    Declaration
    public static bool GetRenderBounds(GameObject target, out Bounds bounds, LayerMask ignoreLayers)
    Parameters
    Type Name Description
    GameObject target

    GameObject to generate the bounds around.

    Bounds bounds

    An AABB in world space around all the renderers in a gameObject hierarchy.

    LayerMask ignoreLayers

    A LayerMask to restrict the colliders selected.

    Returns
    Type Description
    Boolean

    True if bounds were calculated, if zero renderers are present bounds will not be calculated.

    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

    GetScaleToFitInside(Bounds, Bounds)

    Calculates how much scale is required for this Bounds to fit inside another bounds without stretching.

    Declaration
    public static float GetScaleToFitInside(this Bounds bounds, Bounds containerBounds)
    Parameters
    Type Name Description
    Bounds bounds
    Bounds containerBounds

    The bounds of the container we're trying to fit this object.

    Returns
    Type Description
    Single

    A single scale factor that can be applied to this object to fit inside the container.

    GetScaleToMatchBounds(Bounds, Bounds, Vector3)

    Calculates how much scale is required for this Bounds to match another Bounds.

    Declaration
    public static Vector3 GetScaleToMatchBounds(this Bounds bounds, Bounds otherBounds, Vector3 padding = null)
    Parameters
    Type Name Description
    Bounds bounds
    Bounds otherBounds

    Object representation to be scaled to

    Vector3 padding

    padding multiplied into another bounds

    Returns
    Type Description
    Vector3

    Scale represented as a Vector3

    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