Making a particle emitter collide with a rigidbody object?


I have a particle emitter that has a world particle collider attached to it, “send collision message” is enabled.
I have a box with a mesh collider and rigidbody aswell as this script attached to it…

    function OnParticleCollision (other : GameObject)
    var body : Rigidbody = other.rigidbody;
    if (body) {
        var direction : Vector3 = other.transform.position - transform.position;
        direction = direction.normalized;
        body.AddForce (direction * 5);

The particle is definitely hitting the box but its not moving the rigidbody what so ever.
Any idea why this is?


This script must be attached to the particle system, not to the rigidbody. If you want to add a script to the rigidbody instead, it should be:

function OnParticleCollision (other : GameObject){
    var direction : Vector3 = transform.position - other.transform.position;
    rigidbody.AddForce (direction.normalized * 5);

The main difference between both versions: in the first version (particle script), any rigidbody will be affected by this particle system; in the 2nd version (rigidbody script, like above), this rigidbody will be affected by any particle system that has World Particle Collider and Send Collision Message enabled.