Go to: Synopsis. Flags. Return value. Related. Python examples.
geometryConstraint(
[target ...] object
, [name=string], [remove=boolean], [targetList=boolean], [weight=float], [weightAliasList=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
geometryConstraint is undoable, queryable, and editable.
Constrain an object's position based on the shape of the target
surface(s) at the closest point(s) to the object.
A geometryConstraint takes as input one or more surface shapes (the
targets) and a DAG transform node (the object). The
geometryConstraint position constrained object such object lies on
the surface of the target with the greatest weight value. If two
targets have the same weight value then the one with the lowest index
is chosen.
name, remove, targetList, weight, weightAliasList
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 have multiple arguments, passed either as a tuple or a list.
|
[string [] ] ( name of the created constraint node)
aimConstraint, normalConstraint, orientConstraint, parent, pointConstraint, poleVectorConstraint, scaleConstraint, tangentConstraint
import maya.cmds as cmds
# Constrain cube1 to surf1 at the closest point to cube1.
cmds.geometryConstraint( 'surf1', 'cube1' )
# Will prefer surf1 though the weights are equal
cmds.geometryConstraint( 'surf1', 'surf2', 'cube2', w=.1 )
# Now constraints cube2 to lie on surf2 as it's weight is greater
cmds.geometryConstraint( 'surf2', 'cube2', e=True, w=10. )
# Removes surf2 from cube2's geometryConstraint.
cmds.geometryConstraint( 'surf2', 'cube2', e=True, rm=True )
# Adds surf3 to cube2's geometryConstraint with the default weight.
cmds.geometryConstraint( 'surf3', 'cube2' )