移動先: 概要 戻り値 フラグ. Python 例.
angleBetween([constructionHistory=boolean], [euler=boolean], [vector1=[linear, linear, linear]], [vector2=[linear, linear, linear]])
注意: オブジェクト名や引数を表す文字列はカンマで区切ります。これは概要には示されていません。
angleBetween は 「元に戻す」が可能、「照会」が不可能、「編集」が不可能 です。
1 つのベクトルを別のベクトルに回転するために必要な軸と角度を返します。
コンストラクション ヒストリ(ch)フラグが ON の場合、新しいディペンデンシー ノードの名前が返されます。
float[] | 3 つのオイラー角、または軸と角度 |
string | constructionHistory フラグが使用されている場合。 |
constructionHistory, euler, vector1, vector2
: コマンドの作成モードで使用可能なフラグ
|
: コマンドの編集モードで使用可能なフラグ
|
: コマンドの照会モードで使用可能なフラグ
|
: タプルまたはリストとして渡された複数の引数を持てるフラグ
|
import maya.cmds as cmds
# To find the euler angle between these two vectors. The result is three
# angles in the current angular unit. In this example, the first vector
# must be rotated -63.434949 degrees about the X axis, 16.60155 degrees
# about the Y axis and -26.565051 degrees about the Z axis to achieve
# the second vector.
cmds.angleBetween( euler=True, v1=(0.0, 1.0, 2.0), v2=(1.0, 2.0, 0.0) )
# Result: -63.434949 16.60155 -26.565051 #
# To find the angle between these two vectors. The result is an axis and
# an angle (in the current angular unit). In this example, the first
# vector must be rotated 66.421822 degrees about the axis
# (-0.8728716, 0.4364358, -0.2182179) to achieve the second vector.
cmds.angleBetween( v1=(0.0, 1.0, 2.0), v2=(1.0, 2.0, 0.0) )
# Result: -0.8728716 0.4364358 -0.2182179 66.421822 #
# How to create a dependency node that calculates the angle between two
# vectors. This example shows how the (x,z) position of a sphere
# can be used to control the rotate factors (about y) of a cone shape.
angleBtwnNode = cmds.angleBetween(v1=(1, 0, 0), v2=(1, 0, 0), ch=True)
sphere = cmds.sphere()
cmds.move( 5, 0, 5, sphere[0] )
cmds.connectAttr( sphere[0]+'.translateX', angleBtwnNode+'.vector2X' )
cmds.connectAttr( sphere[0]+'.translateZ', angleBtwnNode+'.vector2Z' )
cone = cmds.cone( ch=False )
convert = cmds.createNode( 'unitConversion' )
cmds.connectAttr( angleBtwnNode+'.eulerY', convert+'.input' )
cmds.connectAttr( convert+'.output', cone[0]+'.rotateY' )