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

Synopsis

geometryConstraint [-layer string] [-name string] [-remove] [-targetList] [-weight float] [-weightAliasList] [target...] object

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.

Return value

string[]Name of the created constraint node

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

Related

aimConstraint, normalConstraint, orientConstraint, parent, pointConstraint, poleVectorConstraint, scaleConstraint, tangentConstraint

Flags

layer, name, remove, targetList, weight, weightAliasList
Long name (short name) Argument types Properties
-layer(-l) string createedit
Specify the name of the animation layer where the constraint should be added.
-name(-n) string createqueryedit
Sets the name of the constraint node to the specified name. Default name is constrainedObjectName_constraintType
-remove(-rm) edit
removes the listed target(s) from the constraint.
-targetList(-tl) query
Return the list of target objects.
-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.
-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

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

// Constrain cube1 to surf1 at the closest point to  cube1.
geometryConstraint surf1 cube1;

// Will prefer surf1 though the weights are equal
geometryConstraint -w .1 surf1 surf2 cube2;

// Now constraints cube2 to lie on surf2 as it's weight is greater
geometryConstraint -e -w 10. surf2 cube2;

// Removes surf2 from cube2's geometryConstraint.
geometryConstraint -e -rm surf2 cube2;

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