Getting a collision's bottom-most collider in a hierarchy

Hi!

I've got a projectile colliding with a planet to which various buildings are attached as childs. All have colliders. I'd like to know when a building is hit, but OnCollisionEnter's Collision.collider only gives the topmost GameObject, the planet.

I just read that I could look at the contacts list, but is this really the only way? Isn't there a way to get "collider" to just give the bottommost object directly?

I also know about the raycasting option, but that sounds like an irritating and costly workaround to me.

Thanks!

Actually, I think raycasting is the easiest way. It seems complicated when you've never used it, but read up on it here and try it. :)

You can use GetComponentsInChildren to find the nested colliders:

Collider[] childrenColliders = other.GetComponentsInChildren<Collider>();

(Assuming other is your planet collider)