Feedback

What's your question?

By: [ Editor ] Asked from United States of America

How can I emit particles from a particle collision with a specific object?

My particles hit a number of surfaces. But I want collisions with a specific surface to kill the colliding particle and to emit new particles. I wrote a simple event proc that says if $geometryObject == "mySurface", then print $geometryObject. But it never prints it. If I remove the conditional, it prints "mySurface" just fine.

Thanks in advance

  • 1

georg kaltenbrunner [ Editor ]

You can find out with which collsion object you particle is colliding with the per particle attribute called "collisionGeometryIndex", which can be added from the general tab.

so you could do (assuming index 1 is what you are after, and you have lifespanPP on your particle):

if(particleshape1.collisionGeometryIndex == 1)
{
    vector $pos = particleshape1.position;
    particleshape1.lifespanPP = 0;
    emit -object particle2 -position $pos;
}

obviously the emit command needs some tweaking to get your desired result, but that should give you the idea.

NN comments
manny
-

I was looking through the particle attributes but just now noticed that what is displayed is a “quick index”. Thanks, that’s exactly what I’m looking for.

manny
-

I can’t seem to find this attribute. I get complaints that it doesn’t exist.

georg kaltenbrunner
-

sorry, i forgot to mention that you need to add the PP attribute from the general particle tab.

georg kaltenbrunner
-

sorry, I forgot to mention that the attribute needs to be added. I edited the original answer…

georg kaltenbrunner
-

I’m confused. Did it work out for you in the end or not?

manny
-

Thank you Georg. Adding the attribute gives me the info I need.

julian
-

Hey Manny, thats cool – Please “accept” (click the tick) if the answer solved your question

or Cancel