How can I create a lightning like effect on a ray?

I am trying to make an arcing effect that comes from a part. To do that I used a ray but I am unsure how to make the effect itself. This is a sketch that may help you understand:
yes
If it’s too complicated to divide the length of a ray into those pieces, it would still help if it were the same pieces. I know I can create triangles using the cosines law but I am unsure how…

Don’t re-invent the wheel:

Does it work with rays or not?