The Constraint helper in MassFX lets two rigid bodies work together, as with a door and its frame using the Hinge constraint. Alternatively, you can use a constraint to link a single rigid body to a point in space. For an overview of constraints, see Constraining Physics Objects.
The Constraint helper interface consists of several rollouts on the Modify panel and a couple of modifier stack sub-object levels. These controls are available for only one constraint at a time; if multiple constraints are selected, the rollouts do not appear. However, you can edit multiple selected constraints on the Multi-Object Editor panel of the MassFX Tools dialog. Most of the Multi-Object Editor panel controls are the same as those on the Modify panel.
Procedure
To use the MassFX constraint:
The most convenient way to apply a MassFX constraint is from the MassFX toolbar:
- Create the object or objects to be constrained. Use the Hierarchy panel Pivot controls to position their pivots where you want the constraints to be attached.
For example, if one object is a door, position its pivot along the vertical edge where the hinge would be attached in the real world.
- Depending on whether you want to constrain a rigid body to a point in space or to another rigid body, select one or two objects, respectively.
With two objects, select the parent object first and then select the child object. The child object is the one that is mainly affected by the constraint; for example, with a hinged door, the door is the child and the door frame is the parent.
Tip: Constraints work with
Rigid Body modifiers rather than the objects themselves, but you don't need to apply the modifier first. If the modifier isn't present, you're prompted to add it when you apply the constraint. If you confirm the prompt, MassFX adds the modifiers automatically.
- On the MassFX toolbar, click the active constraint preset or choose a different one from the Constraint flyout.
If prompted to apply the MassFX Rigid Body modifier, click Yes to proceed.
Note: In all cases you're adding the same helper object: a UConstraint. The different presets simply apply various settings based on the type of constraining action to apply. After applying the helper you can adjust these as necessary to create any kind of constraint.
- Move the mouse back and forth horizontally in a viewport to adjust the display size of the constraint, and then click to set the size.
The command panel switches to the Modify panel and displays the UConstraint settings.
- Adjust the settings as necessary and position the objects and constraint where they should start out in the simulation.
Interface
You can move and rotate the constraint to specify its range of permitted motion. For example, rotate a Hinge constraint to indicate extents of rotation of the hinged child.
Modifier Stack - Sub-Object Levels
The modifier stack for MassFX constraints provides access to settings that affect the simulation. When a sub-object level is active, you can change how constraints behave by transforming the respective gizmo.
- Child Attach Point
- The location at which the constraint connects to the child rigid body, depicted as a wireframe cube.
When you access this sub-object level, MassFX automatically selects the Child Attach Point gizmo and activates the Move tool.
Universal constraint with Child Attach Point sub-object active. The red arrow, added for illustrative purposes, indicates the attach point.
- Child Initial Twist
- The default center of angular motion within the constraint's limits, depicted as a wireframe arrow.
When you access this sub-object level, MassFX automatically selects the Child Initial Twist gizmo and activates the Rotate tool.
Universal constraint with Child Initial Twist sub-object (white arrow) active. The red arrow, added for illustrative purposes, indicates the Initial Twist sub-object.
General rollout
Connection group
Use these controls to assign rigid bodies to the constraint. You can assign both parent and child objects to a constraint, or a child object only. The parent can be any rigid body type; the child must be Dynamic.
If you assign both parent and child objects, the motion of the parent (if Dynamic) is affected by the simulation and that of the child is affected by the parent motion, the constraint, and the simulation. If you assign a child object only, the child is affected by the constraint and the simulation.
You can also use these controls to remove objects from the constraint, change the attach points between the constrained objects and the constraint, and reverse the parent/child relationship.
- Parent
- Sets the rigid body to use as the parent of the constraint. Click the button labeled with the name of the associated object, then in the viewport select the rigid body to use as the new parent. The constraint is then linked to the parent object, rotating and moving with it. The parent object can be dynamic or kinematic, but not static.
To remove the parent object, click the X button. When the parent is unset (not linked to any rigid body), as indicated by the "None" label, the constraint is anchored to global space (that is, its current location). Creating a constraint with a single rigid body selected sets that rigid body as the child, with no parent, constraining the rigid body relative to global space.
- Move to Parent's Pivot
- Sets the position of the constraint at the pivot of the parent object. This option is useful for constraints where the child object should rotate around the pivot of the parent, such as a wrecking ball constrained to the tip of a crane.
- Switch Parent/Child
- Reverses the parent/child relationship, so the previous parent becomes the child and vice-versa.
- Child
- Sets the rigid body to use as the child of the constraint. Click the button labeled with the name of the associated object, then in the viewport select the rigid body to use as the new child. The child object can be only a dynamic rigid body, not kinematic or static.
You can use the X button to remove the child object, but that results in an invalid constraint.
- Move to Child's Pivot
- Adjust the position of the constraint to be located at the pivot of the child object. This option is useful for constraints between two bones, for example.
Behavior group
- Constraint Behavior
- Choose whether the constraint uses the acceleration or force of the constrained bodies to determine behavior.
- Use Acceleration Takes acceleration into account when performing spring and damping behavior. The masses of the constrained rigid bodies do not factor into the behavior with this option.
The Use Acceleration option benefits the overall firmness of the joint, but mass balancing across the joint might not behave perfectly.
- Use Force With this mode active, all equations for spring and damping behavior include mass, which results in forces rather than acceleration. The results might be more difficult to control, but can produce more physically accurate behavior.
Note: (For advanced users) When you use this mode, bear in mind that the spring and damping constants consider mass and the center of mass framing relative to the constraint. Use Force mode does not perform any automatic conversion calculations to maintain the same behavior, since this feature is not intended for maintaining the same behavior as Use Acceleration mode. To match Use Acceleration mode's behavior, boost these values manually when using the Soft Limits (see following) option. The fundamental solver calculations inside MassFX are different, so an exact matching conversion for this mode is not possible. As a useful starting point, multiply in the mass of the parent and child.
- Constraint Limits
- Choose how the constraint behaves when the child body reaches the limits, as defined by the settings on the Translation Limits and Swing & Twist Limits rollouts (see following):
- Hard Limits When the child rigid body encounters the edge of the range of motion, it bounces off the limit based on the defined Bounce value.
When Hard Limits is active, only the Limit and Bounce controls are available. Spring and Damping settings apply to soft limits only.
-
Soft Limits
This limit type is called is "soft" because the child can exceed the limit. When the child rigid body encounters the edge of the range of motion (limit), it activates spring and damping behavior to slow down the child and/or apply force to bring it back into the limit.
Note: if forces are strong enough (or, similarly, the Spring values are too low) it can remain outside of the limit indefinitely, since the limit is only the extent where spring and damping behavior activates.
When Soft Limits is active, only the Limit, Spring, and Damping controls are available. Bounce settings apply to hard limits only.
- Icon Size
- The size to draw the constraint helper in the viewports. This property has no effect on simulation; it is just so that you can make your constraints big enough not to be hidden inside the objects they constrain but not too much larger.
Translation Limits rollout
Use these settings to specify the permissible extents of linear movement of the constrained child.
Note: The numeric settings are available only when at least one axis is set to Limited.
- X/Y/Z
- For each axis, choose how to constrain motion along the axis:
- Locked Prevents the rigid bodies from moving along this local axis.
- Limited Allows the objects to move along this local axis by an amount of the Limit Radius (away from the initial offset between the parent and child). If more than one axis is set to Limited, the motion is limited radially: within a circle or sphere, not a square or box. The distance of the Limit Radius is represented visually in the viewports for each Limited axis.
- Free Motion of the rigid bodies along the respective axis is unrestricted.
- Limit Radius
- The distance along the limited axis or axis that the parent and child can move away from their initial offset.
- Bounce
- For any limited axes, the amount that the objects will rebound off the limit when hit. A value of 0.0 indicates no bounce, while a value of 1.0 is full bounce. Available only when Constraint Limits is set to Hard Limits.
- Spring
- For any limited axes, the strength of the "spring" that pulls the objects back to the limit if the limit is exceeded. Small values indicate a low spring force, while larger values will pull the objects with increasing force back to the limit. A value of 0.0 is a special value indicating a hard limit, attempting to prevent the objects from exceeding the translation limit. Available only when Constraint Limits is set to Soft Limits.
- Damping
- For any limited axes, if the translation exceeds the limit, the amount of "mud" they move through beyond the limit. Available only when Constraint Limits is set to Soft Limits.
Swing & Twist Limits rollout
Use these settings to specify the permissible extents of angular movement of the constrained child.
Note: The numeric settings are available only when the Limited option is chosen.
Swing Y and Swing Z groups
Swing Y and Swing Z refer to rotation around the local Y and Z axes, respectively, of the constraint. Choose one of the following for each:
- Angle Limit
- When Swing is set to Limited, the number of degrees away from the center to allow rotation. This is applied to both sides, so the total range of motion is twice this value. For example, if you set Angle Limit to 45 degrees, the total allowed rotation equals 90 degrees.
- Bounce
- When Swing is set to Limited, the amount that the objects rebound off the limit when hit. A value of 0.0 indicates no bounce, while a value of 1.0 is full bounce. Available only when Constraint Limits is set to Hard Limits.
- Spring
- When Swing is set to Limited, the strength of the spring that pulls the objects back to the limit if the limit is exceeded. Small values indicate a low spring force, while larger values will pull the objects with increasing force back to the limit. A value of 0.0 is a special value indicating a hard limit, attempting to prevent the objects from exceeding the swing limit. Available only when Constraint Limits is set to Soft Limits.
- Damping
- When Swing is set to Limited and the limit is exceeded, the amount of "mud" the objects will rotate through beyond the limit. Available only when Constraint Limits is set to Soft Limits.
Twist group
Twist refers to rotation around the local X axis of the constraint.
- Locked Prevent the parent and child objects from rotating around the local X axis of the constraint.
- Limited Allow the parent and child to rotate within a fixed degree range around the local X axis.
- Free Allow the parent and child to rotate unrestricted around the local X axis of the constraint.
- Limit
- When Twist is set to Limited, the Left and Right values are absolute degrees for each edge of the limit. (The visualization of these limits in the viewports can help you to adjust them as desired.)
- Bounce
- When Twist is set to Limited, the amount that the objects rebound off the limits when hit. Each limit may specify a unique value. A value of 0.0 indicates no bounce, while a value of 1.0 is full bounce. Available only when Constraint Limits is set to Hard Limits.
- Spring
- When Twist is set to Limited, the strength of the spring that pulls the objects back to the limit if either limit is exceeded. Each limit can specify a unique value. Small values indicate a low spring force, while larger values will pull the objects with increasing force back to the limit. A value of 0.0 is a special value indicating a hard limit, attempting to prevent the objects from exceeding the swing limit. Available only when Constraint Limits is set to Soft Limits.
- Damping
- When Twist is set to Limited and either limit is exceeded, the amount of "mud" the objects will rotate through beyond the limit. Each limit can specify a unique value. Available only when Constraint Limits is set to Soft Limits.
Spring rollout
The Bounce and Spring settings for the constraint limits (see preceding) control how the constraint behaves past the edges of the limits, while settings on Spring rollout are always applied. These settings are more like what you might call a "spring" in the real world.
Spring to Resting Position group
- Springiness
- The amount of force that always pulls the translation of the parent and child objects back to their initial offset positions. Small values indicate a low spring force, while larger values drive the objects with increasing force back to the initial offset. A value of 0.0 indicates no spring force.
- Damping
- If Springiness is nonzero, the amount of "mud" that restricts the spring force. This does not cause the objects themselves to seem to move through mud, but rather lessens the effect of the spring.
Spring to Resting Swing group
Similar to Spring To Resting Position, but pulls the objects back to their initial rotation offset around the local Y and Z axes instead of their position offset.
Spring to Resting Twist group
Similar to Spring To Resting Swing, but pulls the objects back to their initial rotation offset around the local X axis.
Advanced rollout
- Parent/Child Collision
- When off (the default), the parent and child rigid bodies connected by a constraint cannot collide with one another. This allows, for example, rigid bodies for a thigh and leg to overlap at the knee without problem. Turn on this option to allow the two rigid bodies to react to each other as well as others.
Breakable Constraint group
- Breakable
- When on, the constraint can be broken during the simulation. If a linear force exceeding Max Force or a twisting force exceeding the Max Torque (see following) is applied between the parent and child object, the constraint "breaks"; that is, it turns off and is no longer applied.
- Max Force
- When Breakable is on, the amount of linear force beyond which the constraint will break. To make the constraint more difficult to break, increase the value.
Note: On the Multi-Object Editor panel, this setting is labeled "Break Force."
- Max Torque
- When Breakable is on, the amount of twisting force beyond which the constraint will break. To make the constraint more difficult to break, increase the value.
Note: On the Multi-Object Editor panel, this setting is labeled "Break Torque."
Projection group
- Projection Type
- When the parent and child objects violate the limits of the constraint, projection fixes the situation by forcing them to the limits.
Joint projection is something of a "blunt instrument." It simply moves one actor, disregarding any collisions that might otherwise intervene. This can lead to penetration of collision geometries, so it is recommended that you avoid using joint projection unless there are real problems in terms of joint violation, and then use it judiciously.
Choose a projection method and set the corresponding value(s):
- Distance
- The minimum distance for the constraint violation to exceed for projection to take effect. Errors below this distance will not use projection. Setting this value too low can introduce unwanted oscillations into the simulation.
- Angle
- The minimum angle (in degrees) that the constraint violation must exceed for projection to take effect. Errors below this angle will not use projection.
Relative Nodes rollout
This rollout is available only when the constraint is part of a Ragdoll object.
- Select Ragdoll
- Selects the Ragdoll to which the constraint belongs.