Class BoundsExtensions
Extension methods for Unity's Bounds struct
Inheritance
BoundsExtensions
Assembly: cs.temp.dll.dll
public static class BoundsExtensions
Fields
Declaration
Field Value
Declaration
Field Value
Declaration
Field Value
Declaration
Field Value
Declaration
public const int LB_LT = 7
Field Value
Declaration
Field Value
Declaration
Field Value
Declaration
public const int LBF_LBB = 18
Field Value
Declaration
public const int LBF_RBF = 9
Field Value
Declaration
Field Value
Declaration
Field Value
Declaration
public const int LT_RT = 4
Field Value
Declaration
Field Value
Declaration
public const int LTB_LBB = 14
Field Value
Declaration
Field Value
Declaration
public const int LTF_LBF = 12
Field Value
Declaration
public const int LTF_LTB = 19
Field Value
Declaration
public const int LTF_RTF = 8
Field Value
Declaration
Field Value
Declaration
public const int RB_LB = 6
Field Value
Declaration
Field Value
Declaration
public const int RBB_LBB = 11
Field Value
Declaration
Field Value
Declaration
public const int RBF_RBB = 16
Field Value
Declaration
Field Value
Declaration
Field Value
Declaration
public const int RT_RB = 5
Field Value
Declaration
Field Value
Declaration
public const int RTB_LTB = 10
Field Value
Declaration
public const int RTB_RBB = 13
Field Value
Declaration
Field Value
Declaration
public const int RTF_RBF = 15
Field Value
Declaration
public const int RTF_RTB = 17
Field Value
Declaration
Field Value
Methods
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
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
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
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
|
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
|
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 |
|
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 |
|
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
|
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 |
|
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 |
|
Declaration
public static void GetFacePositions(this Bounds bounds, Transform transform, ref Vector3[] positions)
Parameters
Type |
Name |
Description |
Bounds |
bounds |
|
Transform |
transform |
|
Vector3[] |
positions |
|
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
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 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
|
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
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[] |
|
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
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.
|
Returns the volume of the bounds.
Declaration
public static float Volume(this Bounds bounds)
Parameters
Type |
Name |
Description |
Bounds |
bounds |
|
Returns