I have a sparks particle system and i am wondering how to get them, on collision, to appear. I added it as a child of a machine gun and it is there in the project view and it just wont appear in the game view.
Thanks,
Scott
hmmm well this depends
what are you shooting
is it a projectile
or are you raycasting and giving the illusion of a projectile
if you are shooting a projectile its relatively easy
you make an empty GO containing your projectile mesh and PE
then u use the OnCollisionEnter function
so that when your object collides with a collider it deletes the mesh and emits the particle
for quick and interesting programming specifications i recommend you consult the scripting reference in the help tab on:
colliders (specifically OnCollisionEnter)
ParticleEmitter (-! really cool stuff contained in that one)
if you are looking for a more complicated way (which i think MIGHT be more efficient depending on what u r doing[machine guns])
i would suggest reading up on raycasting
although combining raycast with PE can be a bit risky if u dont do it right (they are both process heavy creatures [again relatively])
You’ll probably want to raycast from the gun and instantiate a particle system that times itself out at the point of impact. There’s a video tutorial here: http://www.design3.com/unity/game-builds/knights-3d-game/item/319-chapter-8-hit-reaction-spark-particles