Best way to create bullet tracers for hitscan weapons?

Hi! My game uses hitscan weapons (line traces) for gameplay purposes, but i want the visual effects to look like actual traveling projectiles. I’ve tried several approaches but i always seam to run into problems related to fast-moving actors or particles. Beams are NOT what i’m looking for.

I’m currently trying to particles with a high initial velocity (5000), but i can’t find a way to reliably make them stop where the line trace hits something. Calculating the lifetime of the bullets from velocity and trace length doesn’t provide precision enough. Kill boxes also let particles slip outside the volume when they are moving fast. Particle collisions makes them stop in the right place but it seams risky to do an individual check not related to the trace.

I know that i’m not the first one trying to put tracer effects on hitscan weapons, how hve other devs managed to do it properly?

Answering myself because i hate this situation: xkcd: Wisdom of the Ancients

I ended up going with beams anyway, since only they had the satisfactory precision. Then i feed beam life and length to the material, using those two and some math on the texture coordinates scroll the texture, creating the impression of a travelling projectile. Due to the curent state of beams in cascade, i have to use the Particle Color parameters as a conduit for life/length, since dynamic parameters doesn’t seam to work.

How were you able to feed data from the particle system to a material?

Figured it out as I was typing this: use the Particle Color node in the material, then use a Initial Color or Color By Lifetime node in the particle system

240345-capture1.jpg