I was wondering if there's a way to make particles behave differently according to the object they collided with. After some hours of trial and error I found this solution:
Let's say you want to have particles raining down on two cubes. Particles that collide with cube 1 shall become red and bounce off the cube (and eventually collide with cube 2), cube 2 shall kill the particles once they collide with it.
- Create an emitter that lets the particles rain down (omni, gravity field)
- Create 2 (or more, it doesn't matter) poly cubes and place them under the emitter in a way that some particles collide with cube 1 and some with cube 2
- name the transform node (pcube1 not pcube1shape) to cube_A and the other one to cube_B
- Make the particles collide with both of them (Particles-->Make collide)
- Select the particleShape and add a per particle collisionGeometryIndex via Add Dynamics Attibutes-->General-->Particle-->collisionGeometryIndex
- Also add an rgbPP Attribute (Add Dynamics Attibutes-->Color-->Add per particle attribute)
- now create a runtime expression on the lifespanPP and rgbPP attribute:
int $index = particleShape1.collisionGeometryIndex;
if( $index != -1 )
string $geoC = `listConnections particleShape1.collisionGeometry[$index]`;
string $shape = `listConnections ( $geoC + ".localGeometry" )`;
if ($shape == "cube_A")
particleShape1.rgbPP = <<1,0,0>>;
if ($shape == "cube_B")
Important: You have to set the lifespan mode to "lifespanPP only" under Attribute Editor --> particleShape1 --> Lifespan Attributes.
You can easily add more collision objects with different effects on the particles, I think a switch-case condition would be more elegant for that.
I attached a scene file with the stuff above, have fun!