Bullet Tracers in UFPS (Unity)

Sharing is caring:

Create Bullet Tracers in UFPS

In this UFPS tutorial we’ll be going over how to create bullet tracers. UFPS uses Raycasting for shooting logic which means no “physical” bullets are being fired. If you’re using a projectile that actually fires from your weapon you could just as easily apply a trail renderer to it and achieve a similar effect.

Since we are not using a projectile we merely want to have a visual representation of a bullet being fired from our weapon.

We’ll start by creating a new particle system and adjusting it’s speed, size and emission of particles to achieve a fairly rapid particle being created then destroyed. We’ll use collisions to enable our particles to die whenever they come in contact with our game world objects that have a collider.

UFPS already has bullet impact effects so there’s no need to add anything of that sort to our particle system.

We’ll finish off the particle system by adjusting the render settings to stretch out each particle to give us a tracer effect. We’ll then add a material that comes with UFPS to create a yellowish/white particle system similar to what you’d might see in a real bullet tracer. You can adjust the tint value to your liking and can use this effect for lasers being fired as well.

 

We’ll then apply the Vp_Muzzle Flash script to the particle system so that UFPS knows it’s to be used as a muzzle flash. The reason for using it as a muzzle flash is to avoid having to create additional scripts to control the logic of how this particle system should be played.

Using it as such means the particle system will be turned on and off whenever we’re able to fire and also disabled if we are out of ammo.After you’ve applied the script, create a prefab from the particle system then open up your advanced player, find your weapon and apply the prefab under the muzzle flash section under VP_FPWeaponShooter.

Now just adjust the position of the muzzle flash so that the particles start at the very tip of the barrel. Keep the fade speed somewhere in the middle. Too low a fade value and the particle system will continue playing long after you’ve released the fire button.

Too high and you’ll barely notice the tracers as they’ll fade out almost instantly. I used a value of .06 and found it to be the sweet spot between showing up just fine and fading out at the correct moment.

Feel free to tweak the settings to your liking. Increasing the particle emission rate means faster particles but they’ll be more bunched up. Increasing the particles and emission rate means faster particles being emitted which is perfect for high rate of fire weapons like a minigun.

Adjusting the “length” scale under the renderer creates a more stretch particle which allows your to create a wider area being used up with less particles. Don’t forget to add the muzzle flash script!

Software Used

Ultimate FPS by Vision Punk

 

Jonathan Gonzalez

I love all things in game development and want to contribute by teaching others how to create games. I'm always looking to help others create awesome digital worlds. I've been a hardcore gamer since I was a kid and now it's my turn to create awesome digital experiences.

More Posts - Website

Follow Me:
TwitterYouTube

Comments

  1. Can u leave every script needed for shooting and reloading for us to download. I just can’t get it right. I’m trying to make a humanoid laser shooting game without the blood, profanity, and etc.

  2. Hi,Jonathan!
    your video was so helpful to me.
    I have implemented trace particles instead of muzzle flash as you instructed.
    but i can’t adjust the muzzle flash position.

  3. you are adjusting the position of muzzle flash position in Vp_WeaponShooter component.
    so i tried as you did,but i can’t get it.
    i am using Unity5.3.4(64 bit) and UFPS 1.7
    could you please provide any help?

  4. Dear Janathan
    Can I get gameobject that fired by bullet?
    Best Regards

  5. Roy Meredith says:

    In looking for a script to use Xbox One controllers,i.e…left and right triggers for acceleration and braking. In New to unity and c#.

Speak Your Mind

*