Another form of procedural animation is Maya's Bullet Rigid Body simulation. As the name implies, this system deals with objects that do not change in shape, as opposed to a system like nCloth that deforms the input mesh (which is called "Soft Body"). You can think of Rigid Body simulation as a physics simulation that calculates how objects should react when they collide. This can be useful when you have too many objects to animate by hand. The Bullet settings are only available from the FX menu set. Bullet also has a cloth simulation system using their own Soft Body simulation system, but since we've already covered soft body simulation with nCloth, we'll stick to rigid simulations in Bullet. Feel free to explore Bullet Soft Bodies in the self-driven part of this assignment!
Note: Bullet may not be automatically loaded into your Maya scene. To load it, go to Windows → Settings/Preferences → Plug-in Manager. Near the top there should be a plug-in named bullet.mll. This will tell Maya to load Bullet, and automatically load it from now on whenever you open it.
You will be using the following script to set up a domino course. First, create a plane and scale it to serve as the ground. Second, create a curve using the CV Curve Tool or the EP Curve Tool (Create → Curve Tools → CP Curve Tool/EP Curve Tool) to lay out the path of your dominoes. Paste the script into your Script Editor (Windows → General Editors → Script Editor) and with the curve selected go to Command → Execute in the menu at the top of the Script Editor window. This will create a set of dominoes with the first one already falling over. Select the plane, assign a new Lambert shader, and change the color so that the dominoes are easier to see.
The next step is to make the objects in your scene dynamic. Select the ground plane and go to Bullet → Create Passive Rigid Body → Options to make it a collidable, non-moving (static) dynamic object. Select each domino (individually, NOT the group!) and go to Bullet → Create Active Rigid Body → Options to make them "active" dynamic objects, which can both collide with other dynamic objects and respond to force fields. There is a third type of dynamic object, "kinematic" rigid bodies, which can move, but will not be moved by other rigid bodies. We will not be using that option for this assignment.
If you select a mesh you have applied a Rigid Body to, it should now have a bulletRigidBodyShape## associated with it, with ## replaced by a number. You can select this by clicking on the wireframe white box around each one of your dominoes, or clicking on a domino and looking at the tabs in the top of the attribute editor. It is a "Shape" node, so if you want to view it in your outliner, you will need to click on Display → Shapes in the menu at the top of the outliner window.
Going to the channel box for the mesh can show you many values you can tweak to make the simulation go as you would like, including initial velocities, impulses, torques, changes in center of mass, friction, and total mass of the object. Try tweaking these values to change how your dominoes will react to one another. Try changing attributes like restitution, friction, and Collider Shape Type to see what they do! Make sure to reset them at the end of this step, however.
Unfortunately, Bullet did one bit of calculation for us wrong. If you try to play the simulation from the first frame, the first domino will always snap back to standing up! Go to the first (leaning-over) domino, where you should see that the Center of Mass Y (and sometimes the Collider Shape Offset Y) are non-zero, while they are zero for all other dominoes. Manually reset these values to 0 for the leaning-over domino, and they should all fall down. Neat!
Once you create a rigid body, an object called BulletSolver1 will be created in your Outliner. Similar to the Nucleus in nCloth, this node is the solver for our simulation, and defines the world that our calculations are made in. Click it and look at the Channel Box to see several options how you can edit the simulation. The most important one will be to make sure you have a negative Gravity Y, so that your dominoes will fall to the ground. Try adjusting some of the other fields and see what they do, but make sure to return them to their default states or your dominoes may begin to do unexpected things. Shown below are (to the left) a sample channel box you would find for your BulletSolver, and (on the right) a sample channel box you would find for one domino.
If you ever want to reset your scene, go to Bullet → Delete Entire Bullet System and all bullet Rigid Bodies and the BulletSolver should be deleted. Also, do not ever create more than one Rigid Body for any single given mesh, or the system will react in unexpected and buggy ways. If you want to remove the Rigid Body for any given mesh, just select the mesh and go to Bullet → Remove Bullet from Selection and it will be cleared.
Hit play and watch the dominoes fall down. Make sure the timeline is set to play every frame: Max Real-time; if we don't, the simulation may skip steps in its calculation, which will often make it very angry and break.(IMPORTANT: Do not duplicate dominoes that are already rigid bodies, as duplicated rigid body nodes will not work. Set up all of your dominoes first, then make them rigid bodies.)
Eventually you are going to want more control over the motion of your dynamic objects. Even cacheing the simulation has it's limitations, as you're not able to directly manipulate the simulation to how you'd like. A rigid body simulation is a good starting point, but there will be a lot of motion you will need to clean up. To do this, you can convert your dynamics into a set of key frames by selecting your dominoes and their Translate and Rotate channels in the channel box, then going to Edit → Keys → Bake Simulation (Options). In the options dialogue, set Channels to From Channel Box. You will want to specify how many frames you want to bake out.
Now you should tweak the motion of the dominoes to remove the jitters. You can do this by deleting all the key frames that occur past the point when the domino should have settled. Make sure to delete the extra keyframes on all of your dominoes - but don't delete any of the motion!
Once you are finished tweaking your dominoes, turn in a playblast of them falling down.