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.
Add Component: Glowing Rifts > Modular Weapon > Shotgun Barrel
✅ Ideal For
- Shotguns
- Scatterguns
- Energy blasters
⚙️ How it works
Each time the barrel fires:
- Each bullet (shell) splits into Pellets Per Bullet pellets, so one shot casts
Bullets Fired x Pellets Per Bulletrays in random directions within a cone defined by theSpreadvalue. - Each ray:
- Applies damage
- Triggers
On Hitevents - 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 |
| Impacts | Prefabs spawned when a hit is registered |
| Hit Events > On Hit | Invoked for each pellet that hits, with the impact point and normal |
| Spread | The angle in degrees to randomly offset each pellet. Higher values result in a wider spread. |
| Pellets Per Bullet | Pellets each bullet splits into. Each pellet deals the full per-bullet damage from the barrel’s Config |
| Pellet Trace | Particle system that draws the pellet traces. One trace is emitted per pellet that hits |
Tip
Keep Bullets Fired at 1 for a classic shotgun. Raise it for a double-barrel that fires two shells at once.