Relation Constraints
Relation constraints are made of multiple boxes (FBBox), which are connected to one another through operators. You can use relation constraints
to create relationships between the objects with greater control than other constraint
types. Following boxes are used for creating relation constraints:
- Senders – Any object with animatable properties (the animatable property must be
set) can act as a sender. A sender transmits data to operators and receivers.
- Operators – An operator performs mathematical operations, comparisons, or conversions
in a relation constraint. It is placed between a sender and receiver. Operators can
receive and send data. You cannot connect two operators that output different results
directly such as, vectors and numbers. To connect two operators that output different
results, a converter box is inserted between the two operators.
- Receiver – Any object with animatable properties (the animatable property must be
set) can act as a receiver. A receiver receives data that is transmitted by operators
and senders.
For information about how to use relation constraints in the UI, see the Relations
Constraints topic in the User's Guide.
Download the create_relationship_constraint.py script from http://area.autodesk.com/downloads/scripts/motionbuilder-animation-scripts. Run the script in MotionBuilder and see how it creates a relation constraint to
drive a cube animation.
Following are the points to keep in mind:
- lConstraintRelation = FBConstraintRelation('AConstraintRelation') is used to create a relation constraint.
- lConstraintRelation.CreateFunctionBox('Sources', 'Sine Ramp') is used to create a sine ramp type function box in a relation constraint.
- lConstraintRelation.SetBoxPosition(lNumberToVectorBox, 400, 30) sets the box's position in the relation constraint panel.
- FBConnect (lSineRampOut, lNumberToVectorIn) connects the two animation nodes to make the first one drive the second one.
- lConstraintRelation.Active = True to set the constraint active.