View Single Post
# 6 20-05-2008 , 01:59 PM
Registered User
Join Date: May 2008
Location: Europe (Germany)
Posts: 7
It's done, there was just a little tweak to be done :attn: . So here's a little walkthrough for those who want to use it. Quite simple, but it's just to get the idea across:

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:

Code:
int $index = particleShape1.collisionGeometryIndex;
if( $index != -1 )
{ 
	string $geoC[] = `listConnections particleShape1.collisionGeometry[$index]`;
	string $shape[] = `listConnections ( $geoC[0] + ".localGeometry" )`;
	
	if ($shape[0] == "cube_A") 
		{
		particleShape1.rgbPP = <<1,0,0>>;
		}
	if ($shape[0] == "cube_B") 
		{
		particleShape1.lifespanPP=0;
		}
}
Important!!! You have to set the lifespan mode to "lifespanPP only" under Attribute Editor --> particleShape1 --> Lifespan Attributes. It took me hours and buckets of coffee to notice that. Rob was raging again user added image

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!

Attached Files
File Type: mb collisions.mb (59.9 KB, 441 views)

Last edited by RaginRob; 20-05-2008 at 02:03 PM.