Go to: Synopsis. Return value. Related. Python examples.
addDynamic( object object )
Note: Strings representing object names and
arguments must be separated by commas. This is not depicted in the
synopsis.
addDynamic is undoable, NOT queryable, and NOT editable.
Makes the "object" specified as second argument the source of an existing field or emitter specified as the first argument. In practical terms, what this means is that a field will emanate its force from its owner object, and an emitter will emit from its owner object. addDynamic makes the specified field or emitter a child of the owner's transform (adding it to the model if it was not already there), and makes the necessary attribute connections. If either of the arguments is omitted, addDynamic searches the selection list for objects to use instead. If more than one possible owner or field/emitter is selected, addDynamic will do nothing. If the specified field/emitter already has a source, addDynamic will remove the current source and replace it with the newly specified source. If a subset of the owner object's cvs/particles/vertices is selected, addDynamic will add the field/emitter to that subset only.string | The name of the source object and the field or emitter which was attached to it. |
import maya.cmds as cmds # Create an emitter cmds.emitter( pos=(0, 0, 0), type='omni', r=100, sro=0, nuv=0, cye='none', cyi=1, spd=1, srn=0, nsp=1, tsp=0, mxd=0, mnd=0, dx=1, dy=0, dz=0, sp=0 ) # Result: emitter1 # # Get the emitter to emit particles cmds.particle() # Result: particle2 cmds.connectDynamic( 'particle1', em='emitter1' ) # Create a particle to use as the source of the emitter cmds.particle( p=((6.0, 0, 7.0), (6.0, 0, 2.0)), c=1 ) # Result: particle2 # Use particle2 as a source of the emitter cmds.addDynamic( 'emitter1', 'particle2' )