Class ColliderExtensions
Extension methods for Unity Colliders, including gizmo drawing and dimension extraction.
public static class ColliderExtensions
- Inheritance
-
ColliderExtensions
- Inherited Members
Methods
DrawCenterMarker(Vector3, Color)
Draws a small solid cube at an object's transform center.
public static void DrawCenterMarker(Vector3 position, Color color)
Parameters
positionVector3The center position to mark.
colorColorThe base gizmo color.
DrawGizmo(Collider, Color)
Draws a gizmo for the collider in the editor using the specified color. Supports BoxCollider, SphereCollider, and CapsuleCollider.
public static void DrawGizmo(this Collider collider, Color color)
Parameters
colliderColliderThe collider to draw.
colorColorThe color to use for the gizmo.
TryGetDimensions(Collider, out float, out float)
Attempts to extract the height and radius from a collider. Supports SphereCollider, CapsuleCollider, BoxCollider, and MeshCollider.
public static bool TryGetDimensions(this Collider collider, out float height, out float radius)
Parameters
colliderColliderThe collider to extract dimensions from.
heightfloatThe extracted height value.
radiusfloatThe extracted radius value.
Returns
- bool
True if dimensions were successfully extracted; otherwise, false.