Working with Rigid Bodies

MassFX provides tools for creating rigid bodies as well as adjusting their settings and their physical shapes: the objects' representations within the simulation.

Creating a Rigid Body

You create a rigid body by applying a MassFX Rigid Body modifier to an object. You can do this from the Modify panel, with the Rigid Body flyout on the MassFX toolbar, or via the commands on the Animation menu Simulation - MassFX Rigid Bodies submenu.

The different toolbar buttons and menu commands all create the same modifier while setting the value of the Rigid Body Type parameter based on your choice. You are free to change the type of the rigid body after creation. For more information on the different rigid body types, see "Rigid Body Types: Dynamic, Kinematic, and Static".

Adding the MassFX Rigid Body modifier to an object automatically adds the object to the simulation.

Try It!

  1. In a new scene, create a teapot.
  2. Move the teapot above the ground (and perhaps rotate it upside down for more interesting results).
  3. On the MassFX Tools dialog World Parameters panel Scene Settings rollout, turn off Generate Shape Per Element.
  4. With the teapot selected, click the Create Dynamic Rigid Body button on the MassFX toolbar.

    A MassFX Rigid Body modifier is added to the modifier stack, with a convex hull created for the physical shape.

    Actually, because Generate Shape Per Element is on, MassFX creates four convex hulls: one for each element of the teapot mesh. With complex shapes like a teapot, this can result in a more-accurate but slower simulation. In a later procedure in this topic you'll see how to create a single hull instead.

  5. Click (Start Simulation) on the MassFX toolbar.

    The teapot falls to the ground, and perhaps bounces and rolls a little.

    Did it fall right through the ground? You probably need to turn on the Use Ground Collisions option on the World Parameters panel.

  6. Click (Start Simulation) again to stop the simulation at the current frame.
  7. Click (Reset Simulation) to return the teapot to its starting location.

Managing the "Initial Transform" of Dynamic Rigid Bodies

If you tried the preceding procedure, you saw that the MassFX simulation moves Dynamic rigid bodies in the scene. Clicking (Reset Simulation) moves all Dynamic rigid bodies back to their starting positions. This starting spot is referred to as the "initial transform" of the rigid body.

How does MassFX know where this transform is? By default, any change you make to the position or rotation of a Dynamic rigid body when the time slider is at the first frame automatically updates the initial transform. Any changes you make to the transform of a Dynamic rigid body when the time slider is not on the first frame are lost when you click (Reset Simulation).

Try It!

  1. With your teapot from the preceding procedure, run the simulation again and then stop it.
  2. With the teapot now on the ground, move it to a new location.
  3. Click (Reset Simulation).

    The time slider jumps back to the first frame and the teapot returns to its initial position, floating above the ground. All your careful placement is ruined!

  4. Now that the animation is on the first frame, move and rotate the teapot again, perhaps starting from a little higher up.
  5. Click (Reset Simulation).

    This time the teapot remains where it is.

  6. Run and then reset the simulation.

    The teapot moves back to its new starting spot.

You can also "capture" as the initial transform the state of a rigid body at any point during the simulation. To do this, use the Capture Transform button on the Simulation Tools panel of the MassFX Tools dialog.

Tweaking the Physical Material

The Density and Mass parameters for a physical material are tied together through the volume of the object. For example, a tiny steel pin and a large steel bollard both have a density around 7.85 g/cm3, but (of course) the pin has a mass that is far less. Heavier objects carry more inertia and can more easily push light objects out of their way.

To make a dynamic rigid body fall faster, you might try increasing its density (or mass) in the Physical Material rollout for the modifier, but that won't do anything. In the idealized world (ignoring air resistance), objects of different sizes and weights all fall at the same speed. (Perhaps you remember something apocryphal about Galileo dropping things from the Leaning Tower of Pisa?) The only ways that you can make an object fall faster are to either:

Moving the object towards the ground may sound obvious and unhelpful, but it brings up the important issue of units.

In a graphics-only world, a brick tower 50 feet tall seen by a person six feet tall standing 10 feet away appears identical to a brick tower 500 feet feet tall seen by a giant 60 feet tall standing 100 feet away. However, a (gigantic) brick falling from that (enormous) 500 feet tower is going to take a lot longer to hit the ground than a (normal) brick falling from just 50 feet up. If you are looking through the giant's eyes while thinking you are a human, you are going to wonder why the brick is falling so slowly.

Try It!

  1. Delete the Rigid Body modifier from the Teapot object, then on the MassFX Tools dialog World Parameters panel Scene Settings rollout, turn off Generate Shape Per Element.

    This causes subsequent applications of the Rigid Body modifier to create a single physical shape for the entire object, no matter how many elements it comprises. The reason for doing it here is to make the rest of the procedure a bit easier to accomplish.

  2. Apply the Rigid Body modifier again.
  3. Check the size of the teapot by looking at the Radius parameter for the Teapot object at the bottom of the modifier stack.
  4. Turn it into a giant teapot by increasing the radius to a suitably large value, given the units of your scene. Make it as big as a football field if you like; the bigger the better.

    The teapot gets bigger but the convex hull does not update along with it.

  5. To regenerate the convex hull, on the MassFX Tools dialog (Multi-Object Editor) panel Physical Mesh rollout, click the Convex button and choose Convex from the drop-down list. Alternatively, tweak any parameter on the Physical Mesh Parameters rollout on the Modify panel.

    The convex hull again encompasses the teapot.

  6. Move the teapot up to about one teapot-diameter off the ground.
  7. Run the simulation.

    The teapot drifts slowly to the ground like a balloon, touching down a couple seconds later.

  8. Reset the simulation, and shrink the teapot back to human proportions (around 8 units radius). Also regenerate the convex hull to fit the new size.

    Now you have a normal-sized teapot floating way up in the air.

  9. Again, move the teapot to be about one teapot-diameter off the ground.

    This time it's only about a foot off the ground.

  10. Run the simulation.

    The teapot hits the ground in less than half a second.

So if your simulation feels like it is on the moon, before cranking up the gravity, first check how big everything is. You can almost hear your high-school teacher saying, "When it comes to physics, units matter!".

The amount of friction you apply to an object determines how easily it slides along other surfaces. For example, a Teflon cube on a Teflon table with friction values of 0.05 (almost no friction) will slide almost indefinitely before coming to a stop. Conversely, two pieces of sandpaper-covered-blocks with friction values of 0.95 (almost full friction) will almost never slide on each other.

MassFX provides two Friction settings:

If you've every tried to push a car or a couch, you may have noticed that it's hard to get it moving, and easier once you're underway. For realistic results, the static friction value should usually be higher than the dynamic friction value.

The Bounciness parameter controls the extent to which objects bounce off each other when they collide.

A rubber ball might have a Bounciness value around 0.75, a foam ball perhaps around 0.2, and a ball made of peanut butter 0.0.

Adjusting the Physical Shape

As described in Physical Shapes versus Graphical Meshes, a rigid body can have one or more physical shapes representing it in the physics simulation. If you haven't read that section, please do so now.

The Modify Shapes group of the Physical Shapes rollout lets you create additional physical shapes. For more information on this (uncommon) situation, see MassFX Rigid Body Modifier. Typically, you'll need multiple physical shapes only if the simulation requires a concave surface on a dynamic rigid body; the easiest way to accomplish this is with the Concave shape type (see following).

The Shape Type setting lets you change the type of (selected) physical shape used for your rigid body. When you choose a mesh type, its parameters appear on the Physical Mesh Parameters rollout on the Modify panel and MassFX Tools dialog > Edit panel. Following are high-level descriptions of the available choices:

Sphere, Box, and Capsule

These are simple, "infinitely smooth" MassFX primitives. Although, by default, these primitives roughly bounding the graphical mesh when created, you can use the parameters (Radius, Length, Width, Height) to control the size of the primitive after creation.

To automatically recalculate the best-fit values after changing your graphical mesh, simply choose the same ShapeType again from the drop-down list. This rebuilds the shape to fit the graphical mesh.

The Sphere is the fastest primitive type to simulate, followed by Box and then Capsule. These are all faster than Convex Hulls, Concave, and Custom mesh types.

Convex

This is the default physical shape type for most rigid bodies because it can be used for every rigid body type and roughly resembles the original graphical mesh.

The default parameters are 32 vertices and no inflation. For better performance at the expense of a rougher approximation, lower the number of vertices. To create a hull larger than the graphical mesh, increase the Inflation value.

To tweak the vertices of the convex hull manually, click the Convert to Custom Shape button on the Modify panel Physical Shapes rollout (for details, see Custom).

Concave

This option provides the easiest method for creating a concave physical shape for use as a Dynamic rigid body. It automatically creates and combines multiple convex hulls (that is, a composite) to create the physical shape based on the vertices in the modified graphical mesh. If the graphical mesh is concave, this option generates the most precise composition of convex hulls to support the concave physical shape. However, using this shape type can consume a lot of resources; use it only if you need a precise concave rigid body.

Note: When you choose this shape type, the composite shapes are not generated until you click the Generate button on the Physical Mesh Parameters rollout. While the mesh is generating, MassFX displays a progress bar with the message "Calculating." After the process is complete, the rollout displays the number of convex hulls.

Original

This option uses the vertices from your graphical mesh to create the physical shape. If your graphical mesh is concave, using the Original mesh type doesn't magically make Dynamic or Kinematic rigid bodies support the concave shape. However, Original gives the best performance to support a concave Static rigid body. If you require a precise concave rigid body, use Concave instead.

For example, create a Plane primitive of 32x32 segments and add a Ripple modifier to it with sufficient amplitude and wavelength to make it bumpy. Set it to be a Static rigid body and set the physical shape type to Original. Dropping Dynamic rigid bodies onto this will cause them to bounce off the ridges and settle into the valleys.

Custom

The Custom mesh type lets you use a copy of an object in your scene whose geometry will serve as the physical shape. To use an object as a physical shape, it must be convex or flat, but not concave.

To use a Custom object, first set Modify panel Physical Shapes rollout Shape Type to Custom. Next, on the Physical Mesh Parameters rollout, click the Pick Mesh From Scene button and select the object in the scene you wish to use for your physical shape. The name of the associated object is then displayed on the button.

Tip: The Custom mesh is created at the location of the source object, so to position it over the rigid body, superimpose the objects before picking the source object, or move the mesh subsequently at the Mesh Transform sub-object level of the rigid body.

The geometry of the Custom object is copied to the MassFX Rigid Body modifier. If you like, you can then delete the Custom object without problem. However, if you don't delete the custom object, you can change its geometry and then use the Update From Source Object function to re-copy the latest information to the modifier.

What if you want to use a Custom physical shape, but do not have one ready-made? For example, maybe the default Convex hull is close to the desired physical shape, but you want to tweak the placement of some of the vertices. Just click Convert To Custom Shape on the Physical Shapes rollout of the Rigid Body modifier (unavailable on the MassFX Tools dialog) for a different shape type. This creates a new editable mesh object in the scene that is associated as a Custom object. Then tweak the mesh object and use the Update From Source Object function.