Go to: Synopsis. Return value. Related. Flags. MEL examples.

Synopsis

orientConstraint [-createCache float float] [-deleteCache] [-maintainOffset] [-name string] [-offset float float float] [-remove] [-skip string] [-targetList] [-weight float] [-weightAliasList] [target ...] [object]

orientConstraint is undoable, queryable, and editable.

Constrain an object's orientation to match the orientation of the target or the average of a number of targets.

An orientConstraint takes as input one or more "target" DAG transform nodes to control the orientation of the single "constraint object" DAG transform The orientConstraint orients the constrained object to match the weighted average of the target world space orientations.

Return value

string[] ( name of the created constraint node)

In query mode, return type is based on queried flag.

Related

aimConstraint, geometryConstraint, normalConstraint, parentConstraint, pointConstraint, poleVectorConstraint, scaleConstraint, tangentConstraint

Flags

createCache, deleteCache, maintainOffset, name, offset, remove, skip, targetList, weight, weightAliasList
Long name (short name) Argument types Properties
-name(-n) string createqueryedit
Sets the name of the constraint node to the specified name. Default name is constrainedObjectName_constraintType
-weight(-w) float createqueryedit
Sets the weight value for the specified target(s). If not given at creation time, the default value of 1.0 is used.
-remove(-rm) edit
removes the listed target(s) from the constraint.
-targetList(-tl) query
Return the list of target objects.
-weightAliasList(-wal) query
Returns the names of the attributes that control the weight of the target objects. Aliases are returned in the same order as the targets are returned by the targetList flag
-offset(-o) float float float createqueryedit
Sets or queries the value of the offset. Default is 0,0,0.
-maintainOffset(-mo) create
The offset necessary to preserve the constrained object's initial orientation will be calculated and used as the offset.
-skip(-sk) string createeditmultiuse
Specify the axis to be skipped. Valid values are "x", "y", "z" and "none". The default value in create mode is "none". This flag is multi-use.
-createCache(-cc) float float edit
This flag is used to generate an animation curve that serves as a cache for the constraint. The two arguments define the start and end frames.
The cache is useful if the constraint has multiple targets and the constraint's interpolation type is set to "no flip". The "no flip" mode prevents flipping during playback, but the result is dependent on the previous frame. Therefore in order to consistently get the same result on a specific frame, a cache must be generated. This flag creates the cache and sets the constraint's interpolation type to "cache". If a cache exists already, it will be deleted and replaced with a new cache.
-deleteCache(-dc) edit
Delete an existing interpolation cache.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

orientConstraint  cone1 cube1;
// Orients cube1 to match cone1.

orientConstraint -w .1 cone1 surf2 cube2;
// Uses the average of the orientations of cone1 and surf2.

orientConstraint -e -w 10. cone1 cube2;
// Sets the weight for cone1's effect on cube2 to 10.

orientConstraint -e -rm surf2 cube2;
// Removes surf2 from cube2's orientConstraint

orientConstraint surf3 cube2;
// Adds surf3 to cube2's orientConstraint with the default weight

orientConstraint -skip x sph1 sph2;
// Constrain the y and z rotation of sph2 to sph1

orientConstraint -e -skip none sph1 sph2;
// Modify the constraint so that it constrains all axes of sph2

orientConstraint -e -cc 1 1000 cube2;
// Create a cache for the orient constraint controlling cube2