using UnityEngine; public static class TouchHelper { /// /// Returns true if objA and objB colliders are touching or overlapping. /// Works for both normal colliders and triggers. /// public static bool IsTouching(GameObject objA, GameObject objB) { if (objA == null || objB == null) return false; Collider colA = objA.GetComponent(); Collider colB = objB.GetComponent(); if (colA == null || colB == null) { Debug.LogWarning("One of the objects has no Collider."); return false; } // Check intersection using bounds return colA.bounds.Intersects(colB.bounds); } }