ExplosiveAmmo

The ExplosiveAmmo script extends ProjectileAmmo to include splash damage using a configurable radius and falloff curve.

Summary

This component:

  • Applies area-of-effect (AOE) damage on impact
  • Scales damage based on distance using a falloff curve
  • Can hit multiple targets

Fields

FieldTypeDescription
rangefloatRadius of the explosion (default: 5).
falloffNormalizedAnimationCurveCurve to scale damage based on distance from explosion center. X = distance %, Y = damage multiplier.

Inherited Fields

See ProjectileAmmo for fields like _speed, _lifetime, and OnImpact.

Collision Behavior

  • On impact:
    • Checks all colliders in range with Physics.OverlapSphere
    • Calculates damage using the falloff curve
    • Applies scaled damage to each Hitbox
    • Fires the OnImpact event
    • Destroys the projectile

Example Falloff Curve

Normalized DistanceDamage Multiplier
0.01.0
0.50.5
1.00.0

Tip

Use this for grenades, rockets, or energy blasts.

Warning

Be mindful of performance when using Physics.OverlapSphere on many projectiles.

See Also