移動先: 概要 戻り値 関連項目. フラグ. Python 例.

概要

constrain([barrier=boolean], [damping=float], [directionalHinge=boolean], [hinge=boolean], [interpenetrate=boolean], [nail=boolean], [name=string], [orientation=[float, float, float]], [pinConstraint=boolean], [position=[float, float, float]], [restLength=float], [spring=boolean], [stiffness=float])

注意: オブジェクト名や引数を表す文字列はカンマで区切ります。これは概要には示されていません。

constrain は 「元に戻す」が可能、「照会」が可能、「編集」が可能 です。

このコマンドは、リジッドボディをワールド、あるいは他のリジッド ボディにコンストレインします。

戻り値

なし

戻り値の型は照会モードでは照会フラグが基になります。

関連項目

rigidBody, rigidSolver

フラグ

barrier, damping, directionalHinge, hinge, interpenetrate, nail, name, orientation, pinConstraint, position, restLength, spring, stiffness
ロング ネーム(ショート ネーム) 引数型 プロパティ
name(n) string createqueryedit
リジッド コンストレインに名前を付けます。
nail(na) boolean createquery
ネイル コンストレインを作成します。このコマンドでは、1 つのリジッド ボディが必要です。
pinConstraint(pin) boolean createquery
ピン コンストレインを作成します。このコマンドでは、2 つのリジッド ボディが必要です。
hinge(hi) boolean createquery
ヒンジ コンストレインを作成します。このコマンドでは、1 つまたは 2 つのリジッド ボディが必要です。
directionalHinge(dhi) boolean createquery
一方向のヒンジ コンストレインを作成します。このコマンドでは、2 つのリジッド ボディが必要です。 一方向のヒンジは、常に初期の軸方向を保持します。
barrier(br) boolean createquery
バリア コンストレインを作成します。このコマンドでは、1 つのリジッド ボディが必要です。
spring(s) boolean createquery
スプリング コンストレインを作成します。このコマンドでは、1 つまたは 2 つのリジッド ボディが必要です。
stiffness(st) float createqueryedit
スプリングの固さの定数を設定します。 デフォルト値: 5.0
damping(d) float createqueryedit
ダンピング定数を設定します。 デフォルト値: 0.1 範囲: -1000.0 ~ 1000.0
restLength(rl) float createqueryedit
レスト長を設定します。 デフォルト値: 1.0
position(p) [float, float, float] createqueryedit
ワールド空間での、コンストレインの初期位置を設定します。 デフォルト値: 単コンストレインの場合は 0.0 0.0 0.0 で、複コンストレインの場合はボディの中間点です。
orientation(o) [float, float, float] createqueryedit
ワールド空間での、コンストレインの初期方向を設定します。このコマンドは、ヒンジとバリア コンストレインについてのみ有効です。デフォルト値: 0.0 0.0 0.0
interpenetrate(i) boolean createqueryedit
コンストレインで定義されたリジッド ボディの貫通を許可(あるいは禁止)します。

: コマンドの作成モードで使用可能なフラグ : コマンドの編集モードで使用可能なフラグ
: コマンドの照会モードで使用可能なフラグ : タプルまたはリストとして渡された複数の引数を持てるフラグ

Python 例

import maya.cmds as cmds

# "Nail" a rigid body at position <<0.0, 2.5, 0.0>>
#
cmds.constrain( 'rigidBody1', nail=True, p=(0, 2.5, 0) )

# "Pin" two rigid bodies together at the position <<0.0, 2.5, 0.0>>.
#
cmds.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>>.
#
cmds.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>>.
#
cmds.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>>
#
cmds.constrain( 'rigidBody1', spring=True, name='spring', p=(0, 2.5, 0), rl=1.0 )