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.
asked Apr 25 '11 at 04:38 AM
You can use GetComponentsInChildren to find the nested colliders:
(Assuming other is your planet collider)
answered Apr 25 '11 at 10:26 AM