The event command assigns collision events to a particle object. Collision events are stored in multi-attributes in the particle shape. The event command returns the event name.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
count (ct) | int | ||
|
|||
delete (d) | bool | ||
|
|||
dieAtCollision (die) | bool | ||
|
|||
emit (em) | int | ||
Emit n additional particles into the assigned target object. The original (colliding) particle survives as well, and remains in its original object. The new particles have age zero and mass equal to the emitting particle. They use the velocity inheritance parameter of the target object. |
|||
idNumber (id) | int | ||
list (ls) | bool | ||
List all events for the chosen shape, like this: event1Name event2Name ... If no shape identified, list all events for all shapes, like this: shape1Name event1Name shape2Name event2Name... Returns a string array. |
|||
name (n) | unicode | ||
|
|||
proc (pr) | script | ||
Specify a MEL proc to be called each time the event occurs. This must be a global proc with arguments as follows: global proc procName( string obj, int id, string objHit ); Arguments passed in are the name of the particle object, the id of the particle which collided, and the name of the object collided with. You can use particle -id -q to get values of the particle’s attributes.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
random (r) | bool | ||
Used with -split and -emit flags. If -random is set true and -split or -emit is set to n, then a random number of particles uniformly distributed between 1 and n will be created at the event. |
|||
rename (re) | unicode | ||
|
|||
select (s) | bool | ||
|
|||
split (spl) | int | ||
Colliding particle splits into specified number of new particles. These new particles become part of the assigned target object. If no target has been assigned, they become part of the same object. The new particles inherit the current age of the particle that split. They use the velocity inheritance parameter of the target object. If you set both emit and split, the event will do both: first emit new particles, then split the original one. This is a change from earlier versions where emit and split were mutually exclusive. |
|||
spread (sp) | float | ||
Particles created at collision will spread out a random amount from the rebound direction of the colliding particle. The spread is specified as a fraction (0-1) of 90 degrees. If spread is set at 0 (the default) all the new particles created may coincide. |
|||
target (t) | unicode | ||
|
Derived from mel command maya.cmds.event
Example:
import pymel.core as pm
pm.event( em=2, t='newCloud' )
# At every collision, emit two new particles into the object
# newCloud. The original colliding particles will survive and
# remain in their original object. This event will be
# assigned to the currently selected object.
pm.event( em=2 )
# At every collision, emit two new particles into the same object.
pm.event( count=1, em=2 )
# At the first collision for each particle, emit two new particles
# into the same object.
# Subsequent collisions for that same particle will not cause any
# additional particles to be emitted. However, the new particles will
# each emit two new ones at their first collision, since they also
# belong to the object for which this event has been assigned.
pm.event( die=1, count=2 )
# All particles in the selected object will die at their second
# collision.
pm.event( 'myCloud', name='foo', count=1, q=1 )
# Return the current value of the count parameter for the event "foo"
# assigned to particle shape myCloud. The order of the flags is
# important. Thef lag you are querying (in this case, -count) must
# come before the -q. The -name flag and the particle object name must
# come after.
pm.event( 'myCloud', d=True, name='foo' )
# Delete the event "foo" assigned to particle shape myCloud.
pm.event( 'myCloud', e=True, name='foo', emit=2 )
# Edit the "emit" value of the event "foo" assigned to
# particle shape myCloud.
pm.event( 'myCloud', proc='myProc' )
# Call the MEL proc "myProc(name, id, name) each time a particle
# of myCloud collides with anything.
pm.event( name='oldName', e=1, rename='newName' )
# For the selected particle shape, rename the event "oldName" to "newName."