- Home /
Continue particle through world particle collider
When I have a world particle collider that lets my particles collide to an object, I want the particles to continue their path.
At the moment I can only manage to bounce or to kill the objects. How do I let the particles continue their way?
Update
Using IsTrigger doesn't seem to work. The objects are still stopped by the Mesh Collider that it bumps into.
What do you mean? Do you want to have the particles go through the collider?
@fireDude67: Yes that is exactly what I mean, because I only want the collision to be detected, so I can execute my own code. The collision event is the only thing I'm ai$$anonymous$$g for.
@fireDude67: If you know more about particle collision, please also consider my other question: http://answers.unity3d.com/questions/130907/particle-collision-on-instantiate-doesnt-send.html
Answer by fireDude67 · Jun 16, 2011 at 06:24 PM
First, you need to create a new Layer. Call it "ParticleCollision". (Go to Edit -> Project Preferences -> Tags. and select "User Layer 8")
Next, go into the World Particle Collider and set the "Collides With" option to ONLY the ParticleCollision layer. Next, duplicate all the colliders that the Particles will collide with, and set their layer to "ParticleCollision" and check the "Is Trigger" option. Now, you can attack a script to the duplicated collider:
function OnTriggerEnter() {
// Insert code here
}
function OnTriggerStay() {
// Insert code here
}
function OnTriggerExit() {
// Insert code here
}
@fireDude67: Ah of course, there is an OnTriggerStay, I was working from the opposite way with OnParticleCollision. But this will STILL kill the particle on collision. When I set the bounce to 0, the particle is killed, because the velocity becomes 0. I want it to continue its path.
This way, the colliders don't actually collide at all. Therefore, no change in velocity is possible.
@fireDude67: So the IsTrigger check makes an object actually colliding or not and even disables default functionality? Very good to know. Couldn't find that in the docs. I'll try it tomorrow and let you know if you're correct =).
@fireDude67: I'm sorry to disappoint you. It doesn't work like this. Using the IsTrigger method still stops the particles from falling. Somehow, it seems that this World Particle Collider works a bit different in its collision model. Do you have any other ideas to check particles with a collision? Should I just create a foreach(particle)
method somewhere?