- Home /
Particle collision with a rigidbody in C#
I have a rigidbody that is not registering collision with particles, even though collision is turned on continuous and particles are bouncing off it. The script attached to the box I built partially from the API's notes on collision:
void OnParticleCollision(GameObject other){
Rigidbody box = other.rigidbody;
if (box){
Debug.Log("Collision!");
Destroy(this.gameObject);
}
}
If this is attached to the box, why are you putting the OTHER in a variable called box?
If i had to guess I would guess that particles don't have a RigidBody themselves.
Try putting a Debug right at the start of OnParticleCollision to see if its getting called at all
Answer by Jeff-Kesselman · Jun 24, 2014 at 04:58 PM
I suspect you are using legacy particle system code with a shuriken particle system.
Read http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnParticleCollision.html carefully.
Note that the Shuriken example does NOT look for a RigidBody.
Your answer
![](https://koobas.hobune.stream/wayback/20220613152422im_/https://answers.unity.com/themes/thub/images/avi.jpg)