Raycast Barrel

The RaycastBarrel is the default and most performant implementation. It uses Unity’s Physics.Raycast to simulate instantaneous hits—ideal for modern firearms or sci-fi weapons.

Add Component: Glowing Rifts > Modular Weapon > Raycast Barrel

✅ Ideal For

  • Pistols
  • Rifles
  • Laser weapons

⚙️ How it works

Each time the barrel fires:

  1. A ray is cast from the spawn point in its forward direction.
  2. If a hit is detected, an event on hit is triggered that you can use:
    • Spawns visual effects (e.g., muzzle flash, bullet holes)
    • Applies damage via DamageData

Note

RaycastBarrel is best for precise, fast-paced shooting systems where projectile physics are not needed.

📐 Additional Settings

Aside from the base barrel logic, the raycast barrel has additional settings highlighted in the red box in the image below

FieldDescription
RangeMax distance of raycast or projectile
LayersWhich layers can be hit
ImpactsPrefabs spawned when a hit is registered
Hit Events > On HitInvoked on each hit with the impact point and normal. Use it for advanced logic or effects

Note

Damage comes from the barrel’s Config stats.