Create a MEL procedure for collision events

To use an event procedure with collision events, your MEL script containing the procedure must have the following format and argument list:

global proc 
myEventProc
(string
$particleObject
, int
$particleId
, string
$geometryObject
) {
Type MEL statements here;
}

Where,

When you create an event procedure, be aware of following:

To add the script procedure to a particle collision event

  1. Open the Script Editor by selecting Windows > General Editor > Script Editor.
  2. In the Script Editor select File > Source Script to source the script that contains the procedure.
    Note:

    If the procedure creates objects, Maya does not delete them when you rewind your simulation. You can also source a procedure without sourcing the script that contains it. See MEL and Expressions for more details on working with scripts and procedures.

  3. in the FX menu set, select nParticles > Particle Collision Event Editor.

    The Particle Collision Event Editor appears.

  4. In the Particle Collision Event Editor do the following:
    • Click Create Event.
    • (Optional) Turn on Original Particles Die if you want the source particle object to die after the collision.
    • Type the name of your event procedure in the Event procedure field.