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:
- It casts multiple rays—one for each pellet—in random directions within a cone defined by the
Spread
value. - 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
Field | Description |
---|---|
Range | Max distance of raycast or projectile |
Layers | Which layers can be hit |
Damage Points | How much damage each shot deals |
Impacts | Prefabs spawned when a hit is registered |
On Hit Event | Allows advanced logic or effects when a hit occurs |
Spread | The angle in degrees to randomly offset each pellet. Higher values result in a wider spread. |
Pellets | List of particle system that acts as number of shots fires per round |