CVR Damage Raycaster
Raycast-based damage source that integrates with the Combat System. Requires a Damage component and a ParticleSystem on the same GameObject ([RequireComponent]). For every newly spawned particle, the raycaster fires one hit ray — letting you use any particle system as a bullet emitter, hitscan line, damage cone, or area-of-effect burst.
Properties
Section titled “Properties”Only Cover From Emitter
Section titled “Only Cover From Emitter”When enabled, the ray is limited to the distance from emitter to particle. When disabled, the ray extends to infinity. Useful for cone-shaped patterns where you want the ray to stop at the particle’s reach.
Behaviour
Section titled “Behaviour”Each Update:
- Reads the current particle set from the attached particle system and builds a delta of added particles (particles are identified by their
randomSeed). - For each new particle this frame, determines the ray origin and direction based on the particle shape type:
- Sphere / Hemisphere / Circle emitters — ray originates at the emitter transform and travels toward the particle.
- Other shapes — ray originates at the intersection of the particle’s velocity with the emitter’s forward plane. If no intersection exists, fall back to the emitter.
- Casts a ray with the emitter’s collision mask (
particleSystem.collision.collidesWith) ignoring triggers. - On hit, dispatches damage via the Combat System (for players) or the matching Object Health component (for world/prop colliders).
Rate limiting
Section titled “Rate limiting”The component uses an internal raycastBuffer that accumulates +1 per cast and decays by 20 * deltaTime per frame. Casts are skipped once the buffer reaches 20, protecting against frames with hundreds of simultaneous particle births.
Source
Section titled “Source”CVR-GameFiles/ABI.CCK.Components/CVRDamageRaycaster.cs