![]()
Emit, kill, or split particles upon contact
You can make particles emit new particles, die, or split into multiple particles when they collide with geometry. You can also execute a MEL script upon collision. The actions that occur after contact are called events.
To create a particle collision event:
- Select the particle object you want to be affected by the event.
- Make the particles and geometry collide.
- Select Particles > Particle Collision Events.
- In the Objects list of the Particle Collision Events Editor, make sure the particle object you want to be affected by the event is highlighted.
- Set the attributes.
- Click Create Event.
- If applicable, set attributes of the split or emitted particles to alter their appearance and behavior.
- Play the animation and watch the event.
To delete a particle collision event
- Select Particles > Particle Collision Events.
- In the Objects list of the Particle Collision Events Editor, select the particle object the event is applied to.
- Select the event you want to edit in the Events window.
- Click Delete Event at the bottom of the window.
To create and source a MEL procedure for use with an event
- Create a MEL script that contains a procedure with this format:
global proc myEventProc (string $particleObject,
int $particleId, string $geometryObject)
{
Type MEL statements here;
}After you complete the following steps, when you play the scene and a collision occurs, the event executes and passes values to the three arguments defined in the procedure:
$particleObject—name of the particle object that collides with the geometry.
$particleId—particle id number of the particle that collides.
$geometryObject—name of the geometry.
Be aware of these issues as you create the procedure:
- You do not need to use the contents of the arguments in your procedure, but they must exist in the procedure definition.
- Name the MEL script the same as the procedure so that the procedure is loaded into memory when you source the script.
- Put the MEL script in the following directory so the script and its procedure are sourced automatically each time you start Maya.
- (Windows)
Drive:\Program Files\Autodesk\Maya8.5\scripts\others- (Linux)
mayapath/scripts/others- (Mac OS X)
/Applications/Autodesk/maya8.5/Maya.app/Contents/scripts/others
- In the Script Editor, select File > Source Script to source the script that contains the procedure.
If the procedure creates objects, Maya doesn’t delete them when you rewind. Note also that you can source a procedure without sourcing the script that contains it. See the MEL and Expressions guide for more details on working with scripts and procedures.
To edit a particle collision event
- Select Particles > Particle Collision Events.
See the figure on the following page for details on window items that help you select events for editing.
- In the Objects list of the Particle Collision Events Editor, select the particle object that the event is applied to.
- Select the event you want to edit in the Events window.
- Edit the option settings in the window.