- Home /
Different particles for different collisions.
Ok i am making a fps game like in all my other questions. But this one i want to know how to make it so when my bullet hits something a different particlle effect will spawn from a sertain object. Like water, a splash particle effect. Steel a spark effect. I used the fps tutorial machineGun script and edited for my liking but i want it so when it hits something something else will spawn. Dont flag this as a ask for code. the code i use is very long and if you got the machineGun code in mind from fps tutorial pleas let me know thank you.
Answer by DaveA · May 09, 2011 at 09:45 PM
Are you detecting the hit on the bullet or on the objects or elsewhere?
One way to do this would be to have each object that gets hit emit its own type of particle.
If you are putting this on the bullet, you might use tags to determine the type of object you hit, then choose the corresponding particle based on that.
So if it's on the bullet or some other object (not the 'thing being hit') just grab the tag and decide which particles to render. You can change out colors, speeds, rates, etc. using GetComponent calls. Use a switch statement, case on the tag, to choose them. Seems like it might be cleaner to have seperate emitters, probably as prefabs, and instantiate them where needed.
Your answer
![](https://koobas.hobune.stream/wayback/20220613133037im_/https://answers.unity.com/themes/thub/images/avi.jpg)