Class UnityColliderContainmentUtils
Whether a point lies inside a collider, and how much space the collider's shape holds (a convex mesh counts as its bounds box).
The containment test is UnityEngine.Collider.ClosestPoint(UnityEngine.Vector3), so it is only available for the shapes that can answer it
(SupportsClosestPoint(Collider)): triggers answer like solid colliders. Physics transforms must be synced
(UnityEngine.Physics.SyncTransforms) after a collider is created or moved in the same frame.
Inheritance
UnityColliderContainmentUtils
Assembly: Serenity.UnityGlobal.Infrastructure.dll
Syntax
public static class UnityColliderContainmentUtils
Methods
Encloses(Collider, Vector3)
Whether the point lies inside the collider or on its surface, give or take a millimetre. A missing, disabled or inactive
collider, or one that cannot answer (a mesh that is not convex, a terrain), encloses nothing.
Declaration
public static bool Encloses(Collider collider, Vector3 point)
Parameters
| Type |
Name |
Description |
| Collider |
collider |
|
| Vector3 |
point |
|
Returns
ShapeVolume(Collider)
The space the collider's shape holds in cubic metres, scaled by its transform (a convex mesh counts as its bounds box); zero if it cannot answer.
Declaration
public static float ShapeVolume(Collider collider)
Parameters
| Type |
Name |
Description |
| Collider |
collider |
|
Returns
SupportsClosestPoint(Collider)
Whether the collider can tell where a point lies against it: a Box, Sphere or Capsule Collider, or a convex Mesh Collider with a mesh.
Declaration
public static bool SupportsClosestPoint(Collider collider)
Parameters
| Type |
Name |
Description |
| Collider |
collider |
|
Returns