In this tutorial you can learn how to simulate interactions between soft and rigid objects and how to include keyframe animated elements in the simulation.
We will use the Bullet engine which is in most cases faster than Maya’s nDynamics engine. It ships with the Maya 2017 installation. To activate Bullet, go to > Windows > Settings / Preferences > Plug-in Manager and at “bullet.mll” make both ticks.
If you like to work in a visually pleasing environment it is recommended to set up your lighting and Viewport 2.0 as described in this tutorial.
Start with a groundplane > Create > Polygon Primitives > Plane and scale it. Bring in the first collision object with > Create > Polygon Primitives > Cube and RMB >Assign New Material. Move it up. Switch the UI mode to “FX” and you should now have Bullet in Maya’s menu.
To start with the Bullet simulation select the cube and > Bullet > Active Rigid Body.
Press Play and the Cube falls through the ground. To include the groundplane in the simulation select it and > Bullet > Passive Rigid Body. Now the cube should stop on the ground. You can rotate the cube at it’s initial position to make the collision more interesting. Before you make changes in your scene always go back to Frame 1 with the |<< button at the playbar. If your simulations runs too fast go to > Windows > Settings / Preferences > Preferences > Time Slider or click on the gear icon below the playbar. Change the Max Playback Speed to Real-time.
Now let’s add a sphere and make it soft. Soft body simulations calculate bending and stretching between polygons and the default sphere’s different polygon sizes delivers not the best topology here. Instead > Create > Polygon Primitives > Cube, hit “3” key and then > Modify > Convert > Smooth Mesh Preview to Polygons. Alternatively the Soccer Ball and the Platonic Polygon Primitives have also a good polygon layout.
Increase the subdivision by repeating the last steps: hit “3” key again and > Modify > Convert > Smooth Mesh Preview to Polygons. Now add the rounded cube to the simulation with > Bullet > Soft Body.
When you now hit play the objects interact with each other. In the Attribute Editor at the bulletSoftBodyShape you can tweak the softness and interaction details. It is recommended to switch on Generate Bend Constraints and Enable Shape and Volume Matching. By increasing the Pressure the shape becomes more stable.
If your soft body slips through the ground, select the bulletSolver object in the Outliner and in the Attribute Editor under Solver Properties activate Ground Plane. If that doesn’t help increase the Internal Fixed Frame Rate to 120 Hz.
Now > Create > Polygon Primitives > Pyramid to bring in the third object. To move objects in other directions than downwards following gravity, you can give rigid bodies an initial velocity. In the Attribute Editor > BulletRigidBodyShape > Initial Conditions you could add Initial Velocity in x direction and let it rotate around z axis for instance by changing the values there.
If you want to have more control over the animation it is also possible to mix keyframed objects with the simulation. The important thing is, that you turn the pyramid into a rigid body before adding keframes. Select the pyramid and > Bullet > Active Rigid Body. Then you can animate it. Go to Frame 1, place the pyramid at the desired position, hit “S” key, go to the next position in the timeline, move the object, hit “S” key and so on. With the pyramid selected then go to the > Attribute Editor > bulletRigidBodyShape tab and switch Body Type to Kinematic RigidBody. This tells the Bullet engine that the pyramid comes with it’s own animation. The Collider Shape Type needs to be set to “hull”, otherwise the Bullet engine would internally work with the default simplified box shape representation. With “Collider Shape Margin” you can adjust the padding around the shape.
When you go back |<< and press play all objects should now interact with each other.
If you want to have more granular control over the simulation especially with soft bodies or if you like to apply different force fields you can alternatively simulate with Maya’s nDynamics engine. It is slower than the Bullet engine but can be more precise. The handling is similar like with Bullet, you find the tools in the FX interface under the nCloth and Field/Solvers menu.