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,
- myEventProc is
the name of the MEL procedure and the script.
- $particleObject is
the name of the particle object that collides with the geometry.
- $particleId is
the particle id of the particle that collides.
- $geometryObject is
the name of the geometry.
When you create an event
procedure, be aware of following:
- 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 file the same as the procedure
so that the procedure is loaded into memory when you source the
script.
- To have your script and its procedure
sourced each time you start Maya, put the MEL script in your Maya
project’s scripts folder. For example, maya\2011\scripts\.
To add the script procedure to a particle
collision event
- Open the Script Editor by
selecting Windows > General Editor > Script
Editor.
- In the Script Editor select File
> Source Script to source the script that contains
the procedure.
NoteIf 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 the MEL and Expressions guide
for more details on working with scripts and procedures.
- Depending on the particle type, do one
of the following:
The Particle
Collision Event Editor appears.
- 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.