When grenades explode, the distance to each damaged element should be computed with the raycast and then health should be removed based on distance. For example, for elements that are at distance zero, all grenade damage should be applied; for elements that are at the radius of detection, no damage should be applied. This can be done, for example, with a simple linear function: damage_applied(distance) = damage - damage * distance / effect_radius.