To whom it may concern,
I am trying to create a fading bullet trail (from a raycast) using a LineRenderer with an assigned gradient (Black--> White--> Black) texture. I can make the bullet trail look very pretty in the scene using the "Particles/Additive (Soft)" shader; however, I cannot make the bullet disappear slowly.
My question is:
How can I get a bullet to fade away?
I know that I should have something like this in a script attached to each bullet:
I just have no idea of where to plug in the visibility variable.
In order to create fading bullet tracers, make a bullet prefab with the attached script at the bottom. The BulletTrail Prefab should have a lineRenderer component with this attached material:
Use the shader called "Particles/Additive" when attaching the material to the lineRenderer.
//Script called "SelfDestruct.js" attached to the BulletTrail prefab.
where visibility is a number between 0 and 1. If your material uses a tint colour, save that in Awake, and then use that instead of Color.white.
answered Oct 24 '11 at 07:32 AM