Bullet tracer Effect with FPS Machine Gun Script + Tutorial

I asked for some help from the Unity members, but I beat you to it and figured it out myself.

Web Player Demo Here: http://ikanimation.webs.com/Game/BulletTracerTest2.html

Now I think it’s a pretty efficient way to add a bullet tracer and it follows every bullet that leaves the FPS machine gun!

What I did was actually really simple, I made a trail render using the laser from the 3rd person Lerpz tutorial and added that as my material. Then I set the line thickness thin to about .12 and the time to .09, added the rocket script to that, and made it a rigid body. Then I got the rocket launcher script and added it to the machine gun as a new empty game object.

Then I made my line render a prefab and added that to the empty game object I just created as the rocket for rocket launcher script.

Then I adjusted rocket launcher script with the speed to 105 and the reload time (which I’m not sure did anything) to 10.9

And that’s pretty much it I’ll make it better as I mess with it some more.

I would post the codes, but I’m sure everyone already has them. Please tell me what you think. Remember this is only my first test.



nice effect, remembers me the sparks of action-racing games.

this effect would be cool for top down games.

It is explained how to do it here too:
http://forum.unity3d.com/viewtopic.php?t=21381&postdays=0&postorder=asc&start=30
Sorry you didnt find it earlier may have saved you some time :frowning:
Least you got it working though :slight_smile:

Something that irked me as a former Marine, was while running we don’t flail the rifle about in one hand. It’s firmly grasped at a tactical carry whilst running, with both hands. One on the hand grip and the other on the carry handle. Other than that the tracer round effect looks pretty good, usually in real life every 5th round is a tracer in a magazine…depends on the situation. Your tracer fire actually looks like a hot flame stream, I’ve only encountered either red or green tracer fire in my time on active duty…so I don’t know? Other than these issues, the effect and timing looks pretty good.

Thanks for the suggestions.

Yeah I wanted the soldier to run with the gun realistically, but I only had a motion capture run for the running and I added a bind to the hand so the weapon would follow the movement of the hand. Everything else was animated by hand so a running motion with the soldier holding the gun with two hands will take me a little while because I want it to look realistic and not fake.

I also want to make it so you can run and fire at the same time. It’s what I’m working on right now. Thanks again for the suggestions.