To use an event procedure with collision events, your MEL script containing the procedure must have the following format and
argument list:
global proc (string
, int
, string
) {
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\2012\scripts\.
To add the script procedure to a particle collision event
- Open the by selecting .
- In the select 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 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 appears.
- In the do the following:
- Click .
- (Optional) Turn on if you want the source particle object to die after the collision.
- Type the name of your event procedure in the field.