Shotgun Barrel

The ShotgunBarrel is a specialized type of RaycastBarrel designed to simulate the behavior of a shotgun. It inherits all the logic from the base barrel, but fires multiple projectiles in a spread pattern.

✅ Ideal For

  • Shotguns
  • Scatterguns
  • Energy blasters

⚙️ How it works

Each time the barrel fires:

  1. It casts multiple rays—one for each pellet—in random directions within a cone defined by the Spread value.
  2. Each ray:
    • Applies damage
    • Triggers On Hit events
    • Can spawn independent visual or physical impacts

Note

The ShotgunBarrel sacrifices pinpoint accuracy for wide coverage, making it perfect for close-range combat.

📐 Additional Settings

Aside from the raycast barrel logic, the shotgun barrel has extra settings highlighted in the red box in the image below

FieldDescription
RangeMax distance of raycast or projectile
LayersWhich layers can be hit
Damage PointsHow much damage each shot deals
ImpactsPrefabs spawned when a hit is registered
On Hit EventAllows advanced logic or effects when a hit occurs
SpreadThe angle in degrees to randomly offset each pellet. Higher values result in a wider spread.
PelletsList of particle system that acts as number of shots fires per round