Bullet Tracer for Machine Gun

Hi everyone

I am scratching my head here trying to find the right question for what I need. My searches for 'bullet tracer' result in all kinds of solutions and directions to generic documentation. My problem is relatively simple (or so I think) - I need a visual hint for the bullets, or 'bullet tracer'. Please point me in the right direction so I can learning a bit more about unity. Thanks!

Are you using the fps tutorial script?

If you are using real bullets instead of rayCasts it will be easer.

If you are using real bullets then you should add Components/Misc/lineRenderer to your bullet object...

for the material create a new material and set the shader to particles/Additive. Then create a gradient in photoShop or Gimp that looks like this(you can use this one if you like):

http://yfrog.com/45basicparticlep

here is a pic of all the settings as they should be:

http://yfrog.com/b5screenshot20101214at859p

make this object a child of the bullet object prefab...

hope this helps! and just comment if you are using the FPS tutorial script or somthing else..

Are your "bullet" attacks simply raycasts at the moment? If so, you have a number of different options. You could create a 2D texture and apply it to a particle emitter (if you are looking for a machine gun type effect). Simply create a prefab object and put a particle emmitter on it (with the particles coming out at high energy and on the local z-axis [something like (0,0,500) for the local velocity]. Then instantiate the prefab with the player's position and rotation (moving it slightly so that it is at the tip of your gun model) and put a script on the prefab to have it destroy itself after 1 second or so. Then do your raycast for the actual hitting (the particles would only be for show. You could make them a trigger and create damage as well... but that's a different question)

Or, if you wanted to (and have the graphics overhead available) you can do what I do and every so often while raycasting for my bullet-hits, I instantiate a prefab that has a simple 3D model of a rounded cylinder with a point-light parented to it. I then script it to destroy itself after a certain time/distance and pick an appropriate shader, and it looks pretty good. I fire this kind of tracer less often than a particle emitter (you could use the same technique with billboarded textures for less graphics hit), but I like the light effect of the point light on the tracer.

Just some ideas...