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 targetDAG transform nodes to control the orientation of the single constraint objectDAG transform The orientConstraint orients the constrained object to match the weighted average of the target world space orientations.
added new syntax for querying the weight of a target object, by passing the constraint first:
aimConstraint( 'pCube1_aimConstraint1', q=1, weight ='pSphere1' )
aimConstraint( 'pCube1_aimConstraint1', q=1, weight =['pSphere1', 'pCylinder1'] )
aimConstraint( 'pCube1_aimConstraint1', q=1, weight =[] )
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
createCache (cc) | float, float | ||
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 flipmode 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) | bool | ||
|
|||
layer (l) | unicode | ||
|
|||
maintainOffset (mo) | bool | ||
|
|||
name (n) | unicode | ||
|
|||
offset (o) | float, float, float | ||
|
|||
remove (rm) | bool | ||
|
|||
skip (sk) | unicode | ||
|
|||
targetList (tl) | bool | ||
|
|||
weight (w) | float | ||
|
|||
weightAliasList (wal) | bool | ||
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 |
Derived from mel command maya.cmds.orientConstraint
Example:
import pymel.core as pm
# Orients cube1 to match cone1.
pm.orientConstraint( 'cone1', 'cube1' )
# Uses the average of the orientations of cone1 and surf2.
pm.orientConstraint( 'cone1', 'surf2', 'cube2', w=.1 )
# Sets the weight for cone1's effect on cube2 to 10.
pm.orientConstraint( 'cone1', 'cube2', e=True, w=10. )
# Removes surf2 from cube2's orientConstraint
pm.orientConstraint( 'surf2', 'cube2', e=True, rm=True )
# Adds surf3 to cube2's orientConstraint with the default weight
pm.orientConstraint( 'surf3', 'cube2' )
# Constrain the y and z rotation of sph2 to sph1
pm.orientConstraint( 'sph1', 'sph2', skip="x" )
# Modify the constraint so that it constrains all axes of sph2
pm.orientConstraint( 'sph1', 'sph2', e=True, skip="none" )
# Create a cache for the orient constraint controlling cube2
pm.orientConstraint( 'cube2', e=True, cc=(1, 1000) )