reactor > 
Scripts and Tools
 
 
 

This topic describes some useful scripts and tools that you can use to speed up your creation of reactor scenes.

If you are interested in creating your own scripts, see the MAXScript Help, available from the 3ds Max Design Help menu.

Setup Scripts

These scripts allow you to quickly set up constraints and collections. They are run automatically when you follow the specified procedures.

Constraint Creation

This applies to all the reactor constraint types, except the Point-to-path constraint.

To create a constraint and attach objects in a single step:

This method works with two or more objects only; it doesn't work with a single-body constraint setup such as Spring with a child only.

  1. Create the object(s) to constrain, and then ensure they are both selected.

    If you select more than two objects, reactor will create constraints between them. If you link the objects together hierarchically in 3ds Max Design before creating the constraints, reactor will create constraints between link parents and children. Otherwise, reactor will examine the scene and try to choose appropriate pairs of objects.

  2. Create the constraint(s) by using the reactor toolbar, menu or quad menu. The constraint automatically appears in the viewport, and as you will see in the constraint's Properties rollout, your objects are now attached to the constraint.

    If the objects are linked in 3ds Max Design, reactor will automatically make the link's child object the constraint child and the link parent the constraint parent. Otherwise, reactor will examine the scene and try to choose an appropriate parent and child.

    In addition, if the constrained objects are already added to a collection, reactor will disable collisions between them (except in the case of springs).

Collection Creation

This applies to all the reactor collection types: rigid body collections, soft body collections, cloth collections, and rope collections. It also applies to the Fracture and Constraint Solver helpers.

To create a collection and add bodies in a single step:

  1. Create the object(s) to add to the collection, then ensure that they are all selected.
  2. Create the collection by using the reactor toolbar, menu or quad menu. The collection automatically appears in the viewport, and as you will see in the collection's Properties rollout, your objects are now added to the collection.

The Rag Doll Utility

This utility lets you quickly set up a simple humanoid character, using a mixture of Rag Doll and Hinge constraints to limit the movement of the character’s limbs. You can use the sample humanoid, or create your own character using the provided naming conventions and the script will set up its constraints. Alternatively, you can use the script as a basis for creating your own custom rag doll script.

Procedures

To create the sample rag doll:

  1. From the Customize menu, choose Customize User Interface. Click the Toolbars tab, and from the Category list, choose reactor. Scroll the list to the Rag Doll Utility action, and then drag the action to a toolbar.

    This creates a “Rag Doll” button. Alternatively, you can use a similar method to create a custom keyboard shortcut or menu/quad entry for the same action.

  2. Click the Rag Doll button or otherwise activate the utility, depending on the CUI method you’ve chosen.

    The Ragdoll dialog opens, with two rollouts: Create Humanoid and Constrain Humanoid.

  3. On the Create Humanoid rollout, ensure that your chosen creation options are on, and then click Create Humanoid. A humanoid figure appears in the viewport.

  4. To set up the humanoid's constraints, ensure that your new humanoid is highlighted in the Humanoids list on the Constrain Humanoid rollout (by default, it's called Ragdoll) and that your chosen options are active on the rollout.
  5. Click Constrain Humanoid.

    The script creates Rag Doll constraints and Hinge joints with appropriate limits for the humanoid. In addition, if Create RBCollection and Create CSolver are on, the script creates these helpers and adds the bodies and constraints to them.

To turn your own humanoid figure into a constrained rag doll:

  1. Create your figure using the naming conventions described in How It Works.
  2. Run the script as described above.

    The script searches the scene for geometry that follows the naming conventions and adds your figure to the Humanoids list.

  3. Ensure your figure is highlighted in the list and then click Constrain Humanoid.

Interface

Create Humanoid rollout

Name Root

This text box stores the root name for the objects to be created. For example, the Name Root "RagDoll" generates objects with names such as RagDoll Pelvis and RagDoll R UpperArm.

Height

The height of humanoid to be created.

Vertebra

The number of vertebra to be created in the character's spine.

Add Hands

When on, reactor creates boxes for the character's hands.

Add Feet

When on, reactor creates boxes for the character's feet.

Link Parts

When on, reactor links the created parts as a 3ds Max Design hierarchy.

Create Humanoid

Click to create the humanoid objects and add them to the scene.

Constrain Humanoid rollout

Humanoids

Displays a list of potential humanoids found in the current scene that could be used for creating rag dolls. In generating this list only the root node is examined so it is, in effect, a list of valid root nodes in the scene. If the rest of the hierarchy does not exist for a given root, when you use the root to create a rag doll 3ds Max Design writes errors to the MAXScript listener.

Vertebra

The maximum number of Rag Doll constraints that the script creates for the character's spine. If this value exceeds the number of valid vertebrae in the selected humanoid, the script won't create the excess constraints.

Create RBCollection

When on, the tool creates a Rigid Body Collection and places all the parts of the newly created rag doll character into it.

Create CSolver

When on, the script adds a Constraint Solver to the scene, which is then associated with the freshly created Rigid Body Collection. All the hinges and rag doll constraints that are created for the selected humanoid are added to this. This option is available only if you have chosen to create a Rigid Body Collection.

Add Hands

When on, if the selected humanoid has hands, the script creates constraints to connect the humanoid's hands to the rest of the body.

Add Feet

When on, if the selected humanoid has feet, the script creates constraints to connect the humanoid's feet to the rest of the body.

Snapshot Parts

When on, the script creates a separate geometry object for each object to be attached to a constraint. It is the newly created snapshot that is then used in the constraint and added to the collection (if a collection is being created).

Link To Original

When on, the newly created snapshot geometries are linked to the original geometries. Available only when Snapshot Parts is on.

Change Name

When on, each geometric component of the new rag doll is prefixed with the text in the New Name field. Available only when Snapshot Parts is on.

New Name

When on, each geometric component of the new rag doll is prefixed with the text in the New Name field.

Constrain Humanoid

Click to create the Rag Doll constraints and, depending on the active options, also create a copy of the source objects, a Rigid Body Collection, and a Constraint Solver.

How It Works

The script works by assuming that you've used the following naming conventions for the rag doll parts. This naming convention follows that used by the character studio Biped object to name the limbs. However, as long as they are named as following, you can use any geometry created in 3ds Max Design. The script scans the selection for geometry with names that include one of the following:

  • _R_UpperArm
  • _R_ForeArm
  • _L_UpperArm
  • _L_ForeArm
  • _R_Thigh
  • _R_Calf
  • _L_Thigh
  • _L_Calf
  • _Pelvis
  • _Spine
  • _Head

The script assumes that there is only one of each type of part, except in the case of the spine, which can have up to five parts.

At this point the adjoining parts are connected, using mostly Rag Doll constraints. However, the script also uses Hinges for the elbow and knee joints, as using Rag Doll constraints would be overkill to achieve the simple constrained motion found in an elbow joint. The script also sets suitable limits for each constraint.

In addition, the script sets the mass of each rigid body in the character to 10.0 kilograms, and the simulation geometry to be a bounding box. It also disables collisions between constrained pairs of bodies.