Go to: Synopsis. Return value. Related. Flags. MEL examples.
constrain [-barrier] [-damping float] [-directionalHinge] [-hinge] [-interpenetrate boolean] [-nail] [-name string] [-orientation float float float] [-pinConstraint] [-position float float float] [-restLength float] [-spring] [-stiffness float]
constrain is undoable, queryable, and editable.
This command constrains rigid bodies to the world or other rigid bodies.
None
In query mode, return type is based on queried flag.
rigidBody, rigidSolver
barrier, damping, directionalHinge, hinge, interpenetrate, nail, name, orientation, pinConstraint, position, restLength, spring, stiffness
Long name (short name) |
Argument types |
Properties |
-name(-n)
|
string
|
![create create](../gfx/create.gif) ![query query](../gfx/query.gif)
|
|
Names the rigid constraint.
|
|
-nail(-na)
|
|
![create create](../gfx/create.gif)
|
|
Creates a nail constraint. This command requires one rigid body.
|
|
-pinConstraint(-pin)
|
|
![create create](../gfx/create.gif)
|
|
Creates a pin constraint. This command requires two rigid bodies.
|
|
-hinge(-hi)
|
|
![create create](../gfx/create.gif)
|
|
Creates a hinge constraint. This command requires one or two rigid bodies.
|
|
-directionalHinge(-dhi)
|
|
![create create](../gfx/create.gif)
|
|
Creates a directional hinge constraint. This command requires two rigid bodies.
The directional hinge always maintains the initial direction of its axis.
|
|
-barrier(-br)
|
|
![create create](../gfx/create.gif)
|
|
Creates a barrier constraint. This command requires one rigid bodies.
|
|
-spring(-s)
|
|
![create create](../gfx/create.gif)
|
|
Creates a spring constraint. This command requires one or two rigidies.
|
|
-stiffness(-st)
|
float
|
![create create](../gfx/create.gif) ![query query](../gfx/query.gif)
|
|
Sets the springs stiffness constant.
Default value: 5.0
|
|
-damping(-d)
|
float
|
![create create](../gfx/create.gif) ![query query](../gfx/query.gif)
|
|
Sets the damping constant.
Default value: 0.1
Range: -1000.0 to 1000.0
|
|
-restLength(-rl)
|
float
|
![create create](../gfx/create.gif) ![query query](../gfx/query.gif)
|
|
Sets the rest length.
Default value: 1.0
|
|
-position(-p)
|
float float float
|
![create create](../gfx/create.gif) ![query query](../gfx/query.gif)
|
|
Set initial position of the constraint in world space.
Default value: 0.0 0.0 0.0 for uni-constraints, midpoint of bodies for deul constraint.
|
|
-orientation(-o)
|
float float float
|
![create create](../gfx/create.gif) ![query query](../gfx/query.gif)
|
|
Set initial orientation of the constraint in world space. This
command is only valid with hinge and barrier constraints
Default value: 0.0 0.0 0.0
|
|
-interpenetrate(-i)
|
boolean
|
![create create](../gfx/create.gif) ![query query](../gfx/query.gif)
|
|
Allows (or disallows) the rigid bodies defined in the constrain to ipenetrate.
|
|
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.
|
// "Nail" a rigid body at position <<0.0, 2.5, 0.0>>
//
constrain -nail -p 0 2.5 0 rigidBody1;
// "Pin" two rigid bodies together at the position <<0.0, 2.5, 0.0>>.
//
constrain -pin -n pin -p 0 2.5 0 rigidBody1 rigidBody2;
// "Hinge" a rigid body at the position <<0.0, 2.5, 0.0>>.
//
constrain -hinge -p 0 2.5 0 rigidBody1;
// Create a barrier for a rigid body which will not allow the rigid body
// to fall below (in y by default) the plane defined by the
// barrier point <<0.0, 2.5, 0.0>>.
//
constrain -barrier -p 0 2.5 0 rigidBody1;
// Add a "Spring" to a rigid body at the position <<0.0, 2.5, 0.0>>
// connected on the rigid body at point <<0, 0, 0>>
//
constrain -spring -name spring -p 0 2.5 0 -rl 1.0 rigidBody1;