bool IsOverlaping(Vector3 position) { for (int i = 0; i < distances.Count; i++) { LayerDistance current = distances[i]; Collider2D overlappingCollider2d = Physics2D.OverlapCircle(position, current.distance, current.layerMask); if (overlappingCollider2d != null) { // Debug.Log ("overlapping " + overlappingCollider2d.gameObject.ToString () + " @ " + overlappingCollider2d.transform.position); return(true); } } return(false); }
bool IsOverlaping(Vector3 position) { for (int i = 0; i < layerDistances.Count; i++) { LayerDistance current = layerDistances[i]; Collider2D overlappingCollider2d = Physics2D.OverlapCircle(position, current.distance, current.layerMask); if (overlappingCollider2d != null) { // Debug.Log ("overlapping " + overlappingCollider2d.gameObject.ToString () + " @ " + overlappingCollider2d.transform.position); #if UNITY_EDITOR Debug.DrawLine(this.transform.position, overlappingCollider2d.transform.position, Color.red, 5f); #endif return(true); } } return(false); }