Maya lets you easily add dynamic properties to the objects in your scenes. All attributes that can be modified by selecting menu items, can be accessed by setting the arguments of a Maya command.
In this section you create a dynamic simulation using MEL so that the stack of barrels reacts to gravity and moves in a realistic manner. Apply a rigidBody node to all of the barrels, add a gravity field and a passive rigid body plane for the barrels to collide with.
For more information about rigid bodies and fields within dynamics in Maya, see Lesson 2: Rigid bodies and constraints and the Dynamics guide in the Maya Help.
To add rigid body nodes to the barrels using MEL
select -allDagObjects;
move -r 0 (0.5*$diameter_barrel) 0;
performDynamics 1 Gravity 0;
When a gravity field is added to the geometry, rigid body nodes are automatically added to the geometry.
To create a plane for the barrels to simulate against
polyPlane -height 100 -width 100;
rigidBody -passive;