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
- Select all the barrels by typing the
- Move the stack of barrels upwards along
Y (by half the height of a barrel) so they are not intersecting
the ground plane.
move -r 0 (0.5*$diameter_barrel) 0;
- Add a gravity field to the selected geometry
by entering the following in the Script Editor.
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
- Make a plane for the barrels to simulate
against by typing the following:
polyPlane -height 100 -width 100;
- With the plane selected, add a rigid
body node to the plane by typing the following:
To view the simulation
- Click the play button on the time slider
to view the dynamics simulation.