November 12, 2024 Workshop 14
Notes
CLOTH AND
CONSTRAINTS
- We begin by creating a cloth surface from a polygon and
animating it. We will then vary some of the constraints cloth that will
impact how it moves. Note that we use polygons for generating cloth
objects in this workshop. Note also that the instructions are related to Maya 2020 although some of the animations below were generated from an earlier version of the software
- Create two arcs in order to make the first cloth.
- In the modeling module, use the loft tool to generate a
polygonal mesh between arcs. Note the loft tool allows for the
specification of a polygon rather than nurb object. Set section
spans to 6 in the loft dialog box.
- Now, working from the front view and then in the perspective view
window, create a cylinder from the polygons shelf tool.
- Go to the FX module , select the cylinder, and choose
nCloth/Create Passive Collider.
- Select the lofted polygonal mesh, and choose nCloth/Create
nCloth, using the default options.
- Create 200 frames and play the animation. The results should
approximate the following movie (select image to load movie).
- Lets add some constraints to the cloth, such that it is pinned
along a line. Using the "Select by Components" mode, and select the cloth. Next
used the selection tool and the shift key from the front view to select a linear alignment of control vertices.
- Select menu item "nConstrainy/Transform Constraint"and Apply.
- Go back to the 1st
frame, and play the animation. See how the movement of the cloth is now
constrained by the line as if it was a clothing line.
- Go to "Fields/Solvers" menu, and select the item "Air" along with it's checkbox. In the dialog box that follows, name the windfield air1". Set direction to X = 1, and Y = 1. Set
attenuation to 0. Leave magnitude at 4. Select the cloth and then select the "apply" button.
- Go back to the first frame, and try playing animation. Note that
the cloth is barely impacted by the wind.
- Now select the wind field, and set its attribute for "magnitude"
to 40. Replay the animation.
- Go to the air attribute editor, right-click on magnitude and
enter the following expression (the name "air1" was used in this
example to create this wind field):
air11.magnitude = sin(deg_to_rad(frame * 10)) * 50;
- Go back to frame 1 and replay the animation. Note the oscillation
pattern due to the wind magnitude oscillation.
- Create a 12 x 12 polygon mesh, convert to nCloth, and constrain
it to a multiple vertices on a 1 degree curve (a segmented line) at
some
arbitrary height above the x-z plane, similar to how this was done with
the preceding cloth.
- In object mode, select one line of newly constained vertices on
the cloth such that you are able to see dynamic constraints (e.g.,
dynamicConstraintShape2) appear in the channels box. Change over to the
Attributes Editor
- In the Attributes Editor, note that the there is a check-box
adjacent to the word "Enable". To get to the expression editor, you are
unable to Right-click directly on the word "Enable"; however, you can
right-click on the attribute "Constraint Method" just below it, and
open the expression editor. Once you've entered the expression editor,
use the object and attribute "dynamicConstraintShape2.enable"
- The last step opens the expression editor. In the Attributes scroll area select the "enable" attribute. Consquently, the text "dynamicConstraintShape2.enable" is automatically placed in the text box
"Selected Object and Attribute"
- Now go to the expression creation text area and enter the following MEL code:
if (frame < 50) {
dynamicConstraintShape2.enable = on;
}
else
{
dynamicConstraintShape2.enable = off;
}
- Play back the animation and note the temporary constraint
placed on the cloth, which causes it to fold, before dropping and
colliding with the second cloth.
- In a new scene file, create a 12 x 12 divided polygon
surface and place it above the ground . Make the polygon
surface into a nCloth object. Create a cylinder polygon with 12
"height" subdivisions and make in a passive nCloth object.
Play an animation of 200 frames and observe the behavior.
- Next, right-click on the 12x12 flat polygon surface. Choose
"vertex" and select the middle vertices of the polygon surface as
indicated in the image below. Shift-select the cylinder. Select the
menu item "nConstraint/Slide on Surface".
- Play back the animation and observe the result.
- The shape of
the cylinder is reflected in the cloth as it slides along it at a
constrained distance.
- Go to the attribute editor for the cylinder's y rotate value, open
the expression editor, and enter "pCylinder1.rotateY = frame * 5;" (use
the name of the cylinder if it is not pCylinder1.rotatey.
- Play back the animation and observe the result.
- Create a polygonal 12 x 12 mesh, convert to nCloth, and
placeit alongside the existing polygon such that the edges touch
as shown in the image below. Under the nConstraint menu choose "Weld
Adjacent Borders".
- Play the animation and see the result.
- Finally, select the first 12 x 12 polygon, and under
nConstraint, select "Make Tearable Surface" along with the checkbox to open up the dialog box. Select on the "Use Sets" option and then select the cloth surface direcly above the cylinder and then select the Apply Button.
- Note that the cylinders collision with the "tearable" surface will tear it into fragments during the animation sequence.
- Play back animation.
The strength of this surface is adjustable under the attributes
editor.