- Home /
4.0 shuriken: particle collision with GameObjects
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.
Try This link: http://answers.unity3d.com/questions/240973/particle-collsion-with-a-separate-object.html
Once you know how to recoqnise a particle has hit an object, you can add force to it.
Thanks for answering. I have put this project aside since Shuriken is said to be designed for "visual beauty" only.
Answer by Jesper Mortensen · Mar 07, 2013 at 03:00 PM
We are actively working on collision messaging ATM and with any luck it should go into Unity 4.2. With this you will be able to add forces to rigid bodies on particle collisions. I will be sure to add a doc sample that does exactly that.
If you don't $$anonymous$$d me asking, who is "We"? Do you work at Unity?
"We" are the Unity development $$anonymous$$m.
I do work at Unity and have been coding up this feature targeted for shipping in the next Unity 4.2 alpha release. Quite a few people requested this feature, and voila, here it is;-)
Was this ever fixed? I have tried adding a rigid body and collision body. I add a force to the rigid body connected to particle system. I see the collision body bounce around but the particle system just sits in place. Trying to make a fireball that explodes on collision.
Your answer
Follow this Question
Related Questions
Is there a way to adjust the particle collision threshold point ? 0 Answers
Unity Particle System collision detection problem 1 Answer
Shuriken and OnCollisionParticle 1 Answer
Particle prefab with plane collision. 2 Answers
Stop Door Loop 1 Answer