- Home /
How to make OnParticleCollision affect multiple GameObject
I've two kind of projectiles made with particles. The first ones only damage one enemy and it works fine with OnParticleCollision, colliding with the GameObject and allowing me to destroy the item.
Now I want the rest of the projectiles to behave in a different way, I want to remove ALL the GameObjects that collide with my particle system. I've been searching but I can't find anything, and I'm not able to create a script that detects al the GameObjects that collide with the ParticleSysyem.
Answer by Hatdatsat · Sep 20, 2018 at 09:43 AM
So if Im getting this correct you basically want any object hit by a particle to be destroyed?
void OnParticleCollision(GameObject other) {
other.destroy();
}
i havent tested it but i think this should work. the void onparticlecollision triggers when your particle collides with an object (the object needs to have mesh collider!!!!) and the (GameObject other) is the object that is being hit by the collision
Your answer
Follow this Question
Related Questions
Adjusting OnTriggerEnter2D() for OnParticleTrigger() 0 Answers
How to keep particles moving past an obstacle after they have collided with it? 3 Answers
How to create 3D particle effect? 1 Answer
ParticleSystem TriggerModule: Collide with world / collide with unlimited colliders? 0 Answers
3D Particles collision don't work 0 Answers