- Home /
I'm having a problem with particle collision
I am trying to use particle collision to take health away from some human gameobjects. My code is:
function OnParticleCollision (other : GameObject) { if (other == GameObject.Find("Human")) { human = other; human.GetComponent("humanHealth").health -= 1; } }
I have multiple gameobjects called "Human" but when I play the game the particles can only interact with one of them, and will not change the health of the others. Any help is very much appreciated.
Answer by networkZombie · Mar 21, 2011 at 04:46 PM
add a tag called "human" to the project and the add the tag to all humans the change change the if statement to if(other.tag == "human"). This hasn't been tested but it should work.
YES! this is perfect thank you thank you thank you
Your answer
Follow this Question
Related Questions
Collision with Particle Systems 3 Answers
Particle collision for Shuriken 1 Answer
Shuriken Collision Detection 0 Answers