- Home /
how to have bullets produce particles?
i have looked at the partical system in boot camp demo and i am trying to get the different particals for diferent serfaces and i cant find the write script for the job i have the partical systems from there but cant get the write peace of script to let me do so can some one please help me
Answer by zmar0519 · Jan 14, 2011 at 09:46 PM
In the gun.js, you need to find the switch statement on line 399 - 427 and set all of the gameobjects that you want to react to this particle to a different tag(generally the name of the proposed material, eg blood, wood, metal). Also, make sure that the object is on the layer enemy, hit, or hit2. If the object is on the enemy layer, then the dot/cross heir will turn red when it is over it. Make sure to also add a seperate and empty gameobject and give it a collider, placing it on the playercollision layer. this will ensure that the player cannot go through it(whoever designed the bootcamp demo must have had too much time on his hand, if you tried to make it more complex, you wouldn't be able to!!).
thanks for your help but what i am looking for is a script what i could attach to any gun which would shoot out different particals form my gun in my fps
Answer by zmar0519 · Feb 03, 2011 at 11:58 PM
I see. Then you would need something like this:
var gunParticle : ParticleEmitter;
function Awake () { gunParticle.emit = false; } function Update () { if(Input.GetButtonDown("Fire1")) { gunParticle.Emit(); } else { gunParticle.Emit(); }
}
if you wanted to make it like a machine gun, then use GetButton
not GetButtonDown
.