Constraining Objects


Constraints are ways to limit the amount of motion that an object can do. Using constraints can help control objects in the scene as they interact with other objects. Perhaps the simplest constraint is to enable the Unyielding option in the Property Editor. This option makes a rigid body that won't move and is a good option for the ground plane.

Other constraints are found in the reactor image from book Create Objects menu and consist of Constraint Solver, Rag Doll Constraint, Hinge Constraint, Point-Point Constraint, Prismatic Constraint, Car-Wheel Constraint, and Point-Path Constraint, as listed in Table 37.4.

Table 37.4: reactor Constraints
Open table as spreadsheet

Toolbar Button

Name

Description

image from book

Constraint Solver

Contains all active constraints used in the scene

image from book

Rag Doll Constraint

Causes a model to act as a human figure

image from book

Hinge Constraint

Allows angular rotation like a hinge

image from book

Point-Point Constraint

Links two points together; good for rope ends

image from book

Prismatic Constraint

Used to constrain the motion of two rigid bodies to a single axis with no rotation

image from book

Car-Wheel Constraint

Causes a car to move linearly as a wheel object is rotated

image from book

Point-Path Constraint

Limits a point to move only along a path

After a constraint object is added to the scene, you can select the objects that will be included as child and parent objects using the buttons in the Properties rollout. The Properties rollout also includes buttons to align the constraint to the Child Body, Parent Body, Child Space, or Parent Space. For each constraint, you can set the Strength and Tau of the connection. This determines how strong the link is and how easily broken. In addition to the Strength and Tau values, you can set Limits and allow the hinge to be Breakable under a defined Linear or Angular force value. The Threshold value defines the breakability of the constraint. Higher Threshold values make it less likely to break. The Threshold value works only with reactor, version 3.

NEW FEATURE 

The Threshold value is new to 3ds Max 9.

When a constraint's Child is first selected, the Constraint's icon is positioned at the pivot point of the child object. If you look in the Modifier Stack for the Constraint object, you'll find subobject modes for Child Space and Parent Space. If you select these subobject modes, you can change the position of the constraint's child and parent objects.

Using a Constraint Solver

In order to use most constraints, you need to add a Constraint Solver to the scene. Then you can use the Modify panel to add Constraints to the list to be solved. The Constraint Solver needs to know about any Rigid Body Collections that are attached to any Constraints in the scene. To identify all the Constraints that are part of the Constraint Solver, click the Highlight button.

Tip 

If the simulation includes any constraints that the Constraint Solver doesn't know about, the Constraint Solver icon appears red in the viewports.

Rag Doll constraint

The Rag Doll constraint defines all the joint limits common in a human figure. It can be used to animate a lifeless body colliding with various rigid body objects. Using the Rag Doll constraint, you can manually define how the body joints can twist, rotate, and move.

These joints are fairly common for human bodies. Discreet has created a script to create a human body proxy that creates a rag doll with the correct constraints already defined. The script is named rctRagdollScript.ms. It can be found in the scripts directory where 3ds Max is installed.

You can execute this script by opening the Utilities panel, clicking the MAXScript button, and clicking the Run Script button. This opens a file dialog box. Locate the script and click Open, and the script runs. Running this script opens the Rag Doll dialog box, shown in Figure 37.12. Using this dialog box, you can provide a Name for the rag doll and set its Height and the number of Vertebra. The Create Humanoid button makes the rag doll appear in the viewports.

image from book
Figure 37.12: Fully constrained humanoid figures can be created using the rctRagdollScript.ms script.

Once positioned, you can press the Constrain Humanoid button in the Constrain Humanoid rollout. This adds all the necessary constrains to the rag doll.

The Point-to-Point constraint lets you attach two objects together by a common point. The attach point is the pivot point of the child and parent objects. It can be used to animate a lifeless body colliding with various rigid body objects. Using the Rag Doll constraint, you can manually define how the body joints can twist, rotate, and move.

Tutorial: Swinging into a wall

Playing with the rag doll object is just plain fun. Remember that in the Preview window you can use the right-click button to throw the doll around. For this example, we use a couple of Point-to-Point Constraints along with a Rag Doll constraint to create a simple scene where the rag doll swings from a rope into a brick wall.

To animate a rag doll swinging on a rope, follow these steps:

  1. Open the image from book Swinging into a wall.max file from the Chap 37 directory on the DVD.

    This file includes a simple scene consisting of several Boxes, a Cylinder for the rope, and a brick wall.

  2. Open the Utilities panel, and click the MAXScript button. Click the Run Script button in the MAXScript rollout. In the file dialog box, locate the Scripts directory where Max is installed. Select the rctRagdollScript.ms file, and click the Open button. The script file opens in a MAXScript window. In the MAXScript window, select the File image from book Evaluate All menu command to make the Rag Doll panel appear.

  3. In the Rag Doll panel that appears, open the Create Humanoid rollout and click the Create Humanoid button. Then move the Rag Doll panel to the side, but don't close it. Select the rag doll that appears at the origin, and move it so that one of its hands is positioned close to the end of the Cylinder object.

  4. In the Rag Doll panel, open the Constrain Humanoid rollout and click the Constrain Humanoid button. This automatically adds all the needed constraints for the rag doll. Then close the Rag Doll panel.

  5. Select the long Cylinder object, choose reactor image from book Create Object image from book Point-Point Constraint, and click in the Left viewport close to the rag doll. In the Properties rollout, click the Child button and select the hand object that is close to the Cylinder. Then enable the Parent option, click the Parent button, and select the Cylinder. Open the Modify panel, select the Parent Space subobject mode, and move the gizmo in the Front viewport to be on the Cylinder. Do the same for the Child Space subobject.

    This defines where the two objects will be attached.

  6. Repeat Step 5 to create a Point-to-Point Constraint where the Cylinder touches the roof object with the Cylinder as the Child object and the roof as the Parent object. With the second Point to Point Constraint selected, click on the Align Spaces to Parent Body button in the Modify panel.

  7. Press the H key to open the Select Objects dialog box, and select the RagdollRBCollection object. Then click the Add button in the RB Collection Properties rollout. Click the All button in the Select Rigid Bodies dialog box, and click Select. Repeat this step for the RagdollCSolver icon to add the two new Point-to-Point Constraints.

  8. Select all three Box objects in the scene, and choose reactor image from book Open Property Editor. In the Physical Properties rollout, enable the Unyielding option. Then select the Cylinder object, and set its Mass value to 0.5.

  9. Select reactor image from book Preview Animation to see the resulting preview. Then select reactor image from book Create Animation to create the animation keys.

Figure 37.13 shows the swinging rag doll.

image from book
Figure 37.13: Using constraints gives you control over the animation motion.




3ds Max 9 Bible
3ds Max 9 Bible
ISBN: 0470100893
EAN: 2147483647
Year: 2007
Pages: 383

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net