Hi,
I’m trying to make a gun throwing liquid using the particle system from unity 4.0 (shuriken I think).
So the particle system is on-set, the particles are bouncing on world objects, I activate the gun by pressing “fire1” and when released it stops firing.
Now I need the particles to push objects with rigidbodies. I have found the OnParticleCollision function, but I think it’s only working on the legacy system.
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);
}
}
Does anybody know how to apply force to an object (with a rigidbody and collider) when it is hit by a particle ?
Any tutorial, link, code example, piece of advice is welcome !
Thanks in advance.