public void Set(Entity entity, Transform transform, BoxCollider collider) { this.collider = collider; this.entity = entity; this.transform = transform; colliderTag = collider.Tag; center = transform.Position; collider.CalculatePoints(transform); // Diagonal distances var diagonal1 = (collider.Points.c - collider.Points.a).Length(); var diagonal2 = (collider.Points.d - collider.Points.b).Length(); double maxDiagonal = diagonal1 > diagonal2 ? diagonal1 : diagonal2; sortDistance = (float)(maxDiagonal / 1.95); }