View Single Post
# 1 19-05-2008 , 11:05 PM
Registered User
Join Date: May 2008
Location: Europe (Germany)
Posts: 7

Solved: How to check for collision with a particular object?

Hi there,

I'm looking for a solution to this:

I want to create a moving vacuum cleaner with particles and fields. My scene contains a plane (the floor), a moving polygon bar that emits the dust particles and spreads them over the floor, and the "head" of the cleaner.

The dust particles "rain" down on the floor and collide with it (without resilience). Once the floor is full of particles, the cleaner starts moving along a motion path over the particles. The cleaner head has a parented newton field with a cube volume which sucks in the particles within the volume shape.

Up to this point everything works just fine. The problem is: I need the particles to die as soon as they are sucked in, otherwise they gather around the field and occasionally show up. So I thought it would be best to make the particles collide with the cleaner head and then let them die via the Collision Event Editor. The problem is, the particles now die as soon as they touch the floor as this also is a collision. How can I tell them to only die when they collide with the cleaner head geometry? Is there a way to check with wich object the particles actually collides?

[UPDATE]

I found a way to distinguish the collision object! Now I can check if the particle collides with the floor or any other object. See the simplified scene file here:

https://www.megaupload.com/?d=LLPGILIL

I wrote an expression that changes the color of the particle to red as soon as it collides with the cleaner head. It doesn't react when colliding with the floor. Now all I have to figure out is how to let the particle die instead of turning red? I've been playing around with lifespanPP but it didn't work so far. Here's the expression I use:

Code:
int $idx = particleShape1.collisionGeometryIndex;
if( $idx != -1 )
{
string $geoC[] = `listConnections particleShape1.collisionGeometry[$idx]`;
string $shape[] = `listConnections ( $geoC[0] + ".localGeometry" )`;
// print( $shape[0] + "\n");
if ($shape[0] == "Staubsauger")
{
particleShape1.rgbPP = <<1,0,0>>;
particleShape1.lifespanPP = -1;
}
}


Last edited by RaginRob; 20-05-2008 at 12:55 PM.