Tracking the position of a particle collision.

Posted by on Nov 23, 2010 in code, dynamics, Maya, MEL | No Comments

Rough guide:

  1. Create planes, one above the other, scale to 10 units square, and place in positive unit space.
  2. Select the top plan. Make it emit particles: Particles > Emit From Object >options (select “surface” as emitter type).
  3. Make particles and ground plane collide. Select the particles, Shift-select the plane, then select Particles > Make Collide.
  4. Select particlesShape, add CollisionU and CollisionV attributes. Set the lifespan attribute to LifespanPP only.
  5. Create a locator called loc.
  6. Create a dynamic expression with the code below.
float $colU = particleShape1.collisionU;
float $colV = particleShape1.collisionV;


if ($colU > 0) {
	particleShape1.lifespanPP=0;
	loc.translateX = ($colU*10);
	loc.translateZ = ((1 - $colV) * 10);
}

Scene file.

Email this to someoneTweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponShare on RedditDigg this

Leave a Reply