View Full Version : Multiple Collision Events

03 March 2011, 01:52 PM
Hi everyone,

I'm trying something really basic which seems to be addressed in other threads, but I don't quite know how as I'm a super beginner with particles.

I want to have two collision events, an emitter its two objects, and hitting object A it emits, hitting object B kills the particle.

Could anyone explain how to do this easily (I'm a real newbie to dynamics), I tried to use the Particle Collision Event Editor, and using the collision number, but that really didnt work for me.


05 May 2011, 09:11 PM
If you use normal particles and not nParticles this will work.

You have 1 emitter and 2 objects you are colliding with.

The event editor is very simple 1 interaction event - not overly useful when you want to do this kind of thing.
Unfortunately you'll have to script this in maya. Fortunately for you I did this for the current project.

Code - edited for you!

lifespanPP = 10;

images/icons/icon4.gifWarning: particle's name is particle1. If it is something different you have to change this line (in the code below):images/icons/icon4.gif
`listConnections particleShape1.collisionGeometry[$index]`;
vector $pos = pShape.position;
vector $vel = pShape.velocity;
string $objP = "emitP";

int $index = collisionGeometryIndex;
//print ("Index objects: "+$index+"\n");
if( $index != -1 )
string $geoC[] = `listConnections particleShape1.collisionGeometry[$index]`;
string $shape[] = `listConnections ( $geoC[0] + ".localGeometry" )`;

print ("Shapes of objects: "+$shape[0]+"\n");

if ($shape[0] == "ObjectB_Name")
lifespanPP = 0
if ($shape[0] == "ObjectA_Name")
//emits 1 particle at point of collision with other's velocity.
string $emit = ("emit -o "+$objP+" -pos "+$pos+" -attribute velocity"+$vel);

CGTalk Moderation
05 May 2011, 09:11 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.