Feedback

type to search

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

Asked by [ Editor ]

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

or Cancel

2 answers

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
1

mark spevick [ Editor ]

to be noted that this attribute does not work correctly for nParticles in maya 2010...grrrr

Now in maya2011 they come clean in the docs....

The collisionGeometryIndex output attribute is not supported for nParticle collision events in Maya 2011.

Oh dear...now no easy real way to manage hirez splahes from a lorez sph particle sim....shame

or Cancel

Your answer

You need to join VFX Overflow to complete this action, click here to do so.