MayaBullet User's Guide


Overview

The MayaBullet plug-in provides access to the Bullet physics engine, which allows you to create large-scale, highly-realistic dynamic and kinematic simulations. You can use MayaBullet to create content for rendered animations for film and visualization, as well as for the setup of game engine and real-time simulations.

For information about installing MayaBullet and loading the plug-in, see your Maya user guide.

This user guide contains the following sections:

This user guide describes the MayaBullet user-interface and explains how to use MayaBullet objects. For advanced Help on the Bullet library, refer to Bullet Physics Manual at www.bulletphysics.org.

User Guide

Bullet Physics is an open-source collision detection, rigid body and soft body dynamics library. The library provides a collection of objects each corresponding to the various aspects of dynamic simulations. For example, the Bullet solver, rigid bodies, soft bodies and constraints are all unique Bullet objects.

 

The Bullet solver is the central object in all dynamic simulations. It calculates the physics for the simulations through iterative time steps that use an object's current state to calculate its next state. To set up a typical MayaBullet simulation, you create the rigid bodies and soft bodies, adjust their attributes, add any required constraints between the objects, then play the simulation. Based on these settings and relationships, the solver updates the scene while advancing one frame at a time through the simulation.

The MayaBullet plug-in provides seamless mapping of Bullet objects to Maya objects. The controls to the Bullet objects are exposed in Maya Objects, and the interaction follows the typical Maya dynamics paradigm.

Running the simulation

The Bullet physics simulation is driven by the Maya timeline. To run a simulation, play the animation from the solver's start frame, which by default is frame 1 in the Maya timeline. To increase the duration of the simulation, increase the length of the timeline.

Bullet operates in time (seconds) and has a fixed rate at which it takes simulation steps. The Bullet solver does not use frames as a time unit. The fixed rate determines the resolution of the simulation and is specified by the solver's Internal Fixed Frame Rate attribute, which is set to 60 steps per second by default. For example, if Maya is set to playback at 30 fps, there would be 2 MayaBullet sub-steps per frame.  

This design and implementation better supports real-time gaming applications where drawing and computation time per-frame must remain near constant. Allowing the solver to vary the number of simulation steps taken between any two drawing frames would greatly undermine the need to maintain a constant drawing speed.

Another way the Bullet solver maintains constant time to step the simulation, is to use an iterative solution algorithm to solve the dynamic systems equations instead of an explicit algorithm. Iterative solutions first approximate a solution, and then feed these values back into the equations to arrive at more accurate solutions. The time the solver spends approximating the solution is constant and is only dependent on the number of equations.  When the solution for a single iteration varies by less than some epsilon, the system is considered to be solved. Depending on the simulation, the solution may require additional iterations before it converges on a solution. The solver’s Max Num Iterations attribute sets a maximum number of times the system of equations is iterated on before the solver stops calculating and uses the last approximate solution as the final solve. Therefore, the total time for a simulation step can be clamped. The drawback to this method is that the results may not be as accurate as more explicit solvers. For most applications in games and movies, the solver's degree of accuracy is sufficient.

The Solver

When you add Bullet objects to a Maya scene, a bulletSolverShape node is created. This node’s attributes manage the overall Bullet physics settings that apply to the entire scene including gravity and wind, and the solver engine that is used (CPU, GPU).

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\SolverAE.png

Solver Properties

Basic Fields

Collision Filters

 

Defines the collision filter names used by rigid and soft bodies when specifying selective collisions. See Collision Filtering - Bullet Physics Manual (www.bulletphysics.org) for more information.

 

Rigid Body and Constraints

Creating rigid bodies

To create a new rigid body, select Bullet > Create Active Rigid Body >Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\MayaBulletGuide_edits_files\image001.jpg  or Bullet > Create Passive Rigid Body >Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\MayaBulletGuide_edits_files\image001.jpg.

After creating an active rigid body, you can still change the rigid body's initial position and orientation with  Maya’s Move tool and Rotate tools if the current time is the same as the Bullet Solver's start time. If the current time is not the same as the Solver's start time, changes to the rigid body position and orientation are ignored when the time changes. Maya automatically detects and stores the new position and orientation as the initial state.

If a mesh is selected when Create Passive Rigid Body is selected, the rigid body is associated with the mesh using the mesh's convex hull as its default collider. If no mesh is selected, a rigid body is created using a box as its default collider shape. You can change the rigid body type by editing the Body Type attribute in the Rigid Body Properties section of the bulletRigidBodyShape node Attribute Editor. You can also change the default settings used when creating new rigid bodies by clicking on the option box to the right of the Bullet menu entry.

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\RigidBodyOptionBox.png

 

Rigid body types

There are three types of MayaBullet rigid bodies. You can specify the rigid body type by setting Body Type in the Create Rigid Body Option window or in the Rigid Body Properties section of the bulletRigidBodyShape node Attribute Editor. In MayaBullet, Dynamic rigid bodies are often referred to as active rigid bodies while Kinematic and Static rigid bodies are also known as passive rigid bodies.

You can animate the rigid body type and its transformation. When the Body Type attribute is set to Kinematic Rigid Body, you can set keys for the rigid body's Transform attributes. Keyed transformations have no effect when Body Type is set to Dynamic Rigid Body. Dynamic rigid body transformations are determined by the solver.

Rigid Body Properties

Attributes in the Rigid Body Properties section of the bulletRigidBodyShape node Attribute Editor determine the behavior of dynamic rigid bodies in the simulation. See bulletRigidBodyShape in the Node Reference for information about how these attributes affect the simulation. Two attributes that deserve special attention are:

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\RigidBodyAE.png

Initial Conditions

This section contains attributes that are applied when the Bullet solver starts simulating.

Forces/Impulses

This section contains attributes that control impulses applied to the rigid body every frame. Note that you will often want to animate these values so that they return to zero. Otherwise, in the absence of any counter-acting forces, continuously applying impulses over an entire animation can cause the rigid body to continuously accelerate.

Collider Properties

These attributes specify how the shape of the rigid body is represented in the simulation. In general, simpler shapes perform better and are more stable and predictable. The simplest shapes are plane (infinite), box, sphere, cylinder and capsule. Their shape is determined by the following attributes:

Enabling Auto Fit in the Create Rigid Body Options window computes the tightest Length, Radius, and Extents when a rigid body is first created. Clicking Refit in the Collider Properties section of the Attribute Editor performs a onetime auto-fit on the existing rigid body. Note that the plane collider represents an infinite plane that passes through the position of the object's transform, and is oriented according to its rotation. It extends infinitely in the local X and Z directions.

Selected mesh colliders

If you selected a mesh as a collider when you created your rigid body, you can change the default creation values for new rigid bodies with mesh colliders in the Create Rigid Body Options window.

After you create a rigid body with a mesh collider, you can use the following collider shape types:

Collision Filters

These attributes let you configure selective collisions. By default, rigid bodies are members of the Default Filter collision group and collide with other members of the Default Filter collision group. The rigid body may be a member of up to 16 groups and can be configured to collide with up to 16 other members of the same group. The collision filter group names can be customized by the Bullet solver's collisionFilters attribute.

See the Bullet Physics Manual (www.bulletphysics.org) for more information about the different collider shape types.

Creating rigid body constraints

You can use the following constraints with rigid bodies:

The behavior of the different constraint types is described in the Bullet Physics Manual (www.bulletphysics.org).

To create a rigid body constraint:

  1. Select one or two rigid bodies. If you select only one rigid body, the constraint is anchored to its position in Maya worldspace.
  2. Select Bullet > Create Rigid Body Constraint >Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\MayaBulletGuide_edits_files\image001.jpg.

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\RigidBodyConstraintAE.png

 Constraint Properties

These attributes determine how the constraint is applied. For example, you can specify how freely the rigid bodies swing or slide by setting Linear Damping or Angular Damping. Linear attributes control the distance between the constraint point and the rigid bodies. Angular attributes control the rotation of the rigid bodies around the constraint point.

Limits

Using these attributes, you can set limits on the constraint's range of motion. The various constraint types support different combinations of limits. In general, linear constraints control the distance of the rigid bodies from the constraint point affecting sliding motions. Angular constraints control the freedom for rigid bodies to rotate around the constraint point affecting twisting and swinging motions.

Limit Properties

These attributes determine how the rigid bodies move when they reach a limit, such as whether they stop abruptly or gently at that limit.

Motors

These attributes let you setup motors which can actively drive the constraint. Typically, rigid bodies attached to a constraint move freely until they come to rest. With motors, the constraints actively move the rigid bodies. The hinge and Six Degrees-Of-Freedom (SixDOF) constraints support angular motors, which rotate the rigid body around the constraint. The slider constraint supports linear motors, which push or pull the rigid body.

Springs

These attributes set the stiffness and dampening effect of the spring on the translation and rotation of the constrained body. Normally, rigid bodies attached to a constraint move freely until they come to rest. The spring hinge and spring Six-DOF constraints support linear and angular springs.

Constraint Type
When you create a constraint, you can select its type from the Constraint Type list in the Create Rigid Body Constraint Options window. After a constraint is created, you can change its type by selecting one from the Constraint Type list of the bulletRigidBodyConstraintShape node Attribute Editor. You can select from the following constraint types:
Point

The Point constraint (called a point-to-point constraint in the Bullet Physics library) limits the translation so that pivot points between the two rigid bodies match in world space. You can use the Point constraint to create effects, such as a chain-link, or to pin objects together.

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\bullet_point_constraint.png 

The Point constraint supports the following attributes:

Hinge

The Hinge constraint restricts the translation and two additional angular degrees of freedom, so the body can only rotate around one axis. The hinge axis is defined by the Z axis of the constraint. This constraint is useful for representing doors or wheels rotating around an axis. The user can specify limits and motor settings for the hinge.

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\bullet_hinge_constraint.png 

The Hinge constraint supports the following attributes:

Slider

The Slider constraint allows rigid bodies to rotate around one axis and translate along the same axis. The slide axis is defined by the Z axis of the constraint.

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\bullet_slider_constraint.png 

The Slider constraint supports the following attributes:

Cone-Twist

For ragdolls, the Cone-Twist constraint is useful for limbs like the upper arm. It is a special point-to-point constraint that adds cone and twist axis limits. The X axis serves as twist axis. 

The Cone-Twist constraint supports the following attributes:

Six Degrees-of-Freedom

The Six Degrees-Of-Freedom (SixDOF) constraint can emulate a variety of standard constraints if each of the six Degrees of Freedom (DOF) is configured. The first 3 DOFs axis are linear axis, which represent the translation of rigid bodies, while the latter 3 DOFs axis represent the angular motion. Each axis can be locked, free, or limited. By default, all axes are unlocked. 

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\bullet_6Dof_constraint.png 

The SixDOF constraint supports the following attributes:

Spring Hinge

The Spring Hinge has three degrees-of-freedom. These include two rotational degrees-of-freedom around Z (Axis 1) and X (Axis 2), and one translational along Z (Axis 1) with a suspension spring. A use-case example of a Spring Hinge constraint is the steering wheel of a car, where one axis allows the wheel to be steered while the other axis allows the wheel to rotate. For this case, you need to rotate the spring hinge -90 in X to align Axis 1 with Y.

The Spring Hinge constraint has an anchor point for Axis 2, which is specified by the position of the constraint. Axis 1 is specified relative to body 1. This would be the steering axis if body 1 is the chassis. Axis 2 is specified relative to body 2 and is perpendicular to Axis 1 (along X). This would be the wheel axis if body 2 is the wheel. Axis 1 (along Z) can have springs as well as angular and linear limits, but Axis 2 (along X) is free. You cannot have springs and motors enabled at the same time. If you want to drive Axis 2, modify the X Torque Impulse of body 2.

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\bullet_spring_hinge_constraint.png 

The Spring Hinge constraint supports the following attributes:

Spring Six Degrees-Of-Freedom

The Spring Six Degrees-Of-Freedom (SpringSixDOF) constraint is a variant of the Six Degrees-of-Freedom constraint that includes the addition of springs for each of the degrees of freedom. Springs and motors cannot be combined on this constraint.

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\bullet_spring_6Dof_constraint.png 

The SpringSixDOF constraint supports the following attributes:

Baking rigid body simulation

Bullet rigid bodies support Maya's standard baking workflow by using Edit > Keys > Bake Simulation. The following workflow creates the least number of animation curves:

  1. Select the rigid body(s) to bake.
  2. Select all the Translate and Rotate attributes in the Maya Channel Box.
  3. Select Edit > Keys >Bake Simulation >Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\MayaBulletGuide_edits_files\image001.jpg. The Bake Simulation Options window appears.
  4. In the Bake Simulation Options window, select From Channel Box.
  5. Click Bake.

The baking process creates an animation curve for each attribute and connects them to the corresponding pairBlend input attribute. An additional animation curve is also created to notify the rigid body when to use the simulation or key-framed result.

Duplicate rigid bodies and constraints

There are two ways to duplicate a rigid body. One way is to use the copy, cut, and paste command combination, while the other is to use Duplicate Special. When you use copy, cut, and paste, the original and duplicate rigid bodies share the existing solver. When Duplicate Special is used, the solver is duplicated along with the rigid body.

To use Duplicate Special do the following:

  1. Select the rigid body and its associated constraints in the scene.
  2. Select Edit > Duplicate Special >Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\MayaBulletGuide_edits_files\image001.jpg. The Duplicate Special Options window appears.
  3. In the Duplicate Special Options window, turn on Duplicate Input Graph.
  4.  Click the Duplicate Special.

Soft Body and Anchors

Creating soft bodies

You can create Bullet soft bodies from Maya polygon meshes. When a soft body is created, a new mesh node, identified by the original polygon object name, suffixed with _Solved, is also created. This object is the mesh that is deformed by the Bullet soft body simulation. Polygon planes work well as cloth soft bodies, although any polygon mesh can be used.

To create a soft body

  1. Select the polygon mesh you want to use as a soft body.
  2. Select Bullet > Create Soft Body >Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\MayaBulletGuide_edits_files\image001.jpg. The Create Soft Body Options window appears.
  3. Configure your soft body options and click Apply and Close.

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\SoftBodyHierarchy.png

 

Soft body attributes

 

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\SoftBodyAE.png

 Soft Body Construction

These attributes affect how the soft body is created.

 Soft Body Properties

These attributes affect how the soft body behaves when simulated by the solver.

Aerodynamics

These attributes affect how the soft body reacts to the air around it.

Pose Matching

These attributes let you setup the soft body pose matching system, which works on closed shapes. You can use any combination of shape and volume matching on a single soft body.

 Contacts

These attributes determine the degree to which the solver resists changes to the soft body's shape when it comes in contact with various types of objects.

Soft Body Solver

These attributes are used by the Bullet solver to modify how it updates the soft body system.

Collision Filters

These attributes let you configure selective collisions. By default, soft bodies are members of the Default Filter collision group and collide with other members of the Default Filter collision group. The soft body may be a member of up to 16 groups and can be configured to collide with up to 16 other members of the same group. The collision filter group names can be customized by the Bullet Solver's collisionFilters attribute.

Duplicate soft bodies and constraints

There are two ways to duplicate a soft body. One way is to use the copy, cut, and paste command combination, while the other is to use Duplicate Special. When you use copy, cut, and paste, the original and duplicate soft bodies share the existing solver. When Duplicate Special is used, the solver is duplicated along with the soft body.

To use Duplicate Special do the following:

  1. Select the soft body and its associated constraints in the scene.
  2. Select Edit > Duplicate Special >Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\MayaBulletGuide_edits_files\image001.jpg. The Duplicate Special Options window appears.
  3. In the Duplicate Special Options window, turn on Duplicate Input Graph.
  4.  Click the Duplicate Special.

Creating soft body anchors

To create a soft body anchor

  1. Do one of the following:
  2. Select Bullet > Create Constraint:Soft Body Anchor.

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\CreateSoftBodyAnchor.png

The vertex is now anchored to the rigid body. The rigid body can be animated or simulated with the results affecting the soft body simulation.

Painting soft body vertex properties

MayaBullet lets you paint per-vertex attributes onto a soft-body. You can paint the Mass, Linear Stiffness, and Bend Resistance attributes. Setting the Mass to zero has the effect of locking the vertex in place.

To paint property values on the vertices of a soft body:

  1. Select the soft body. Soft bodies are identified in Maya’s Outliner by the original polygon object name suffixed by _Solved.
  2. Select Bullet > Paint Soft Body Vertex Properties and select the property to be painted.

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\PaintSoftBody.png

The Maya Paint Attributes Tool is activated allowing you to use all of its painting modes and options. If the Paint Attributes settings are not initially visible, select Window > Settings/Preferences > Tool Settings. To see the weights in the Maya viewport, you need to select Shading > Smooth shade All or Shading > Wireframe On Shaded from the Maya’s Panel menu.

To streamline "pinning" vertices on a soft body by setting their Mass to 0, use the Set SoftBody Vertex Properties option.

  1. Select the vertices you wish to set.
  2. Select Bullet > Set Soft Body Vertex Properties > Mass. The Bullet Soft Body Per-Particle Set window appears.
  3. In the Bullet Soft Body Per-Particle Set window, type a new Mass value. In this case, 0.
  4. Click OK.

Character Setup

MayaBullet provides two tools to assist with setting up characters and other assets based on skeletons (joint hierarchies).

Use the following steps to add kinematic rigid bodies to a skeleton:

  1. Select the root node of the skeleton.
  2. Select Bullet > Add Colliders to Skeleton >Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\MayaBulletGuide_edits_files\image001.jpg.

This tool examines the joint hierarchy starting from the currently selected joint, and creates a capsule around each bone. These capsules follow the animation of the skeleton, and collide with dynamic Bullet objects. Note that the dynamic objects do not affect the character animation. Their interaction only affects the dynamic objects.

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\SkeletonColliders.png

The capsule generation process can be adjusted from the Add Colliders Options window (Bullet > Add Colliders to Skeleton >Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\MayaBulletGuide_edits_files\image001.jpg).

To create a dynamic ragdoll from a skeleton:

  1. Select the root joint the skeleton.
  2. Select Bullet > Create Ragdoll from Skeleton >Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\MayaBulletGuide_edits_files\image001.jpg.

The tool creates a network of dynamic rigid body capsules that correspond to the bones of the skeleton, and connects them with constraints that match the attributes of the joints. The names of the capsules and constraints are based on the names of the joints in the skeleton. This naming convention makes it easier for tools developers when writing exporters or rigging scripts to combine the ragdoll motion with standard skeletal animations.

Description: Description: Description: Description: Description: Description: Description: Description: C:\Users\ellwoor\Documents\Baretta\MayaBullet\MayaBulletFinalDevDrop\doc\doc\images\CreateRagdoll.png

The Create Ragdoll Options window can be customized in the same way as the Add Colliders Options window. In addition to capsule parameters, there are parameters for configuring the constraints. The Joint Name Separator setting can be changed to modify the character(s) that appear between joint names when naming capsules.

Interactive Playback

MayaBullet also provides an Interactive Playback mode. During normal animation playback, you cannot manipulate objects in the Maya scene. By selecting Interactive Playback mode (Bullet > Interactive Playback), you can move scene objects, such as passive rigid bodies, and see them interact in the Bullet simulation.

Interactive Playback only works on passive rigid bodies. To use Interactive Playback, the passive rigid body needs to have an additional transform as the parent so as not to interfere with the transform that the rigid body operates on. Select the additional transform and start Interactive Playback. You can change the Maya move, rotate, and scale tools and see the simulation update according to these changes.

Tutorials

Lesson 1: Rigid Body Simulation with Collision Detection

This tutorial demonstrates the rigid body simulation and collision detection between any two of the three objects.

Lesson 2: Cloth Simulation and Anchor Constraint

This tutorial demonstrates a simple cloth simulation using a soft body plane and an anchor constraint.

Lesson 3: Hinge Constraint Simulation

 

Node Reference

The following is a complete list of MayaBullet nodes:

Known Issues

General

Bullet Solver

· Bullet nodes may not appear correctly in the viewport if the Maya timeline is not rewound to frame 1. This occurs because the solver needs to be reinitialized to recognize new objects. New objects in the scene are reinitialized at frame 1 of the Maya timeline.

 

· The output from the Bullet solver Debug Draw for collisions between soft bodies and plane collider shapes may appear erratic. This occurs because Bullet renders a yellow wire-frame for the triangles that represent the projection of the soft body's axis-aligned bounding box onto the plane. This is the expected behavior. It may be easier to visualize the collisions by viewing the scene from the Top perspective viewport.

 

Rigid Body, Soft Body, and Ragdoll

 

· Output meshes with per-facet shaders cannot locate the bulletSoftBodyShape node when setting the per-particle particleMass attribute. As a workaround, use the source mesh to set the per-particle particleMass attribute.

 

· Ragdoll does not collapse as if the pieces are properly joined.

· An active rigid body does not simulate if its original mesh has had Freeze Transformations performed on it.