Constraining Physics Objects

As the name suggests, a MassFX constraint (or "joint") restricts the movement of rigid bodies in the simulation. Some examples of constraints in the real world include hinges, nails, zip lines, and axles.

All constraint presets create the same type of helper object with the same settings. The different constraint types, such as Hinge and Ball & Socket, simply set some useful default values for the resulting constraint.

A Constraint helper object can either link two rigid bodies together or anchor a single rigid body to a fixed position in global space. The constraint constitutes a hierarchical relationship: The child object must be a dynamic rigid body, while the parent object can be dynamic, kinematic, or nothing (to anchor to global space).

By default, a constraint is "unbreakable": No matter how strong the forces you apply to it or how far you cause it to violate its limits, it will remain in effect and try to move its rigid bodies back into the desired range. However, you can set a constraint to be breakable with independent force and torque limits beyond which the constraint turns off and no longer applies to the simulation.

Parent and Child Objects

Most constraints connect two rigid bodies. The constraint is linked as a child of the parent rigid body, moving and rotating along with it, and as the parent of the child body, to which it transmits the motion of the parent body. For example, in a simulation, the models of a car and its door might be connected by a hinge constraint, with the car as the parent and the door as the child. The limits of how far the door can open and close do not change as the car rotates, but instead are relative to the car's orientation.

A constraint between two dynamic rigid bodies behaves similar to the real world: Forces applied to one rigid body can carry over to the other, in either direction. Most of the time, driving a car pulls the car door along with it. However, if some hefty (and possibly inebriated) fraternity brothers run out of gas and push their car by its open doors, the car body also moves, assuming the doors don't break. If the parent object is dynamic, it is just as likely to move as the child.

Creating a Constraint

To create a constraint between two objects, select the parent object in the scene, followed by the child object, then choose one of the presets from the Constraints flyout on the MassFX Toolbar. The constraint is automatically placed at the pivot point of the parent object. Then, as you move the mouse in a viewport, the system tracks the mouse cursor to set the display size of the constraint. The closer you move your mouse to the parent object, the smaller the constraint becomes. To finalize the constraint display size and finish creating the constraint, click the mouse.

Tip: If either or both objects are not rigid bodies, MassFX asks if you want to automatically apply the Rigid Body modifier before placing the constraint.

You can change the display size later as a property of the constraint. It affects only how large the constraint draws in views, and has no effect on the simulation effects of the constraint.

The placement of the constraint affects the offset from the parent where the constraint is applied. In cases where two rigid bodies abut, such as a door connected to a door frame, you usually place the constraint at the pivot of the child object. But in cases where two rigid bodies are separate, such as a ball swinging from a hook, the ideal position for the constraint is often at the pivot of the parent object. The Advanced rollout of the MassFX Constraint helper has buttons to move the constraint automatically to either of these locations for you.

Creating a World Constraint

You can also constrain a rigid body relative to a location in the scene. This is accomplished by setting the Parent of an existing constraint to nothing, or "undefined," by clicking the X button next to the Parent button on the General rollout of the MassFX Constraint helper. Alternatively, simply assign a constraint to a single selected rigid body; this automatically sets the body as the child and anchors the constraint in space.

Springs and Springy Constraints

The MassFX Constraint helper supports three types of springiness:

Improving Preview Performance

Constraints have custom visualizations in viewports to show the locked/limited/free status of the translation, swing, and twist, along with a representation of those limits. This visualization is helpful for understanding the rotation and limits of a constraint. However, drawing these visualizations affects viewport performance.

If you are previewing a simulation that has many constraints, you might wish to disable the display of helpers to improve the speed of viewport udpates. You can do so on the Display panel by turning on Hide By Category Helpers.