This command constrains rigid bodies to the world or other rigid bodies. In query mode, return type is based on queried flag.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
barrier (br) | bool | ||
|
|||
damping (d) | float | ||
|
|||
directionalHinge (dhi) | bool | ||
|
|||
hinge (hi) | bool | ||
|
|||
interpenetrate (i) | bool | ||
Allows (or disallows) the rigid bodies defined in the constrain to ipenetrate.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
nail (na) | bool | ||
|
|||
name (n) | unicode | ||
|
|||
orientation (o) | float, float, float | ||
|
|||
pinConstraint (pin) | bool | ||
|
|||
position (p) | float, float, float | ||
|
|||
restLength (rl) | float | ||
|
|||
spring (s) | bool | ||
|
|||
stiffness (st) | float | ||
|
Derived from mel command maya.cmds.constrain
Example:
import pymel.core as pm
import maya.cmds as cmds
# "Nail" a rigid body at position ""0.0, 2.5, 0.0""
#
pm.constrain( 'rigidBody1', nail=True, p=(0, 2.5, 0) )
# "Pin" two rigid bodies together at the position ""0.0, 2.5, 0.0"".
#
pm.constrain( 'rigidBody1', 'rigidBody2', pin=True, n='pin', p=(0, 2.5, 0) )
# "Hinge" a rigid body at the position ""0.0, 2.5, 0.0"".
#
pm.constrain( 'rigidBody1', hinge=True, p=(0, 2.5, 0) )
# 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"".
#
pm.constrain( 'rigidBody1', barrier=True, p=(0, 2.5, 0) )
# 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""
#
pm.constrain( 'rigidBody1', spring=True, name='spring', p=(0, 2.5, 0), rl=1.0 )