system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: Why do bombs detonate right before they hit the ground rather than at impact?

If there are bombs that detonate on impact, can someone explain why certian ones do while other don't?
gpt
If a bomb hits the ground and explodes, half or more of it’s energy is wasted hitting the ground, made even worse by the crater it goes into and creates. 

If a bomb explodes at a set height above the ground, nearly all the energy is used to damage what you’re trying to hit. 

Depending on the type of target, some bombs are meant to detonate below ground, like in a bunker. They can go through ground and walls and explode, even as smart as counting floors before explosion. 

Nuclear weapons for example explode at a relatively high height.