private void OnCollisionEnter(Collision collision) { if (collision.gameObject.layer == layerToIgnore) Physics.IgnoreCollision(collision.gameObject.GetComponent<Collider>(), GetComponent<Collider>()); }