Scripting API

ColliderDistance2D

struct in UnityEngine · UnityEngine.Physics2DModule

6 of 6 of Unity's membersUnity's documentation
In Tassix

Collider2D.Distance: between the surfaces, negative by the penetration when overlapped.

Properties 6

float distance { get; set; }
bool isOverlapped { get; }
bool isValid { get; set; }
Vector2 normal { get; }

From pointB to pointA.

Vector2 pointA { get; set; }

The closest point on the first collider.

Vector2 pointB { get; set; }

The closest point on the second collider.