移動先: 概要 戻り値 フラグ. Python 例.

概要

pathAnimation( [objects] , [bank=boolean], [bankScale=float], [bankThreshold=angle], [curve=string], [endTimeU=time], [endU=float], [follow=boolean], [followAxis=string], [fractionMode=boolean], [inverseFront=boolean], [inverseUp=boolean], [name=string], [startTimeU=time], [startU=float], [upAxis=string], [useNormal=boolean], [worldUpObject=name], [worldUpType=string], [worldUpVector=[float, float, float]])

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

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

pathAnimation コマンドは必要なグラフ ノード、およびモーション パス アニメーションの相互接続を作成します。モーション パス アニメーションには、1 つのカーブ、および 1 つ以上のその他のオブジェクトが必要です。 アニメーション中は、そのオブジェクトが、3D カーブかカーブ オンサーフェスに沿って移動します。

移動オブジェクトの指定方法には、以下の 2 つがあります。

  1. コマンド ラインで明示的に名前を指定する
  2. インタラクティブに、または MEL コマンドを使用してオブジェクトを選択する

同じように、モーション カーブの指定方法にも、以下の 2 つがあります。

  1. モーション カーブの名前をコマンド ラインで明示的に指定する(つまり、-c curve_name オプションを使用する)
  2. 移動するオブジェクトを選択してから、モーション カーブを選択するつまり、モーション カーブの名前をコマンド ラインで指定していない場合は、セレクション リストで最後に選択したオブジェクトがモーション カーブになります。

終了時間を指定しないと、カレント タイム、もしくは指定した開始時間でキーフレームが 1 つだけ作成されます。

戻り値

string(作成された motionPath ノードの名前)

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

フラグ

bank, bankScale, bankThreshold, curve, endTimeU, endU, follow, followAxis, fractionMode, inverseFront, inverseUp, name, startTimeU, startU, upAxis, useNormal, worldUpObject, worldUpType, worldUpVector
ロング ネーム(ショート ネーム) 引数型 プロパティ
bank(b) boolean query
true に設定すると、移動オブジェクトのアップ軸をパス ジオメトリの曲率に合わせることができます。
デフォルトは false です。
照会すると boolean を返します。
bankScale(bs) float query
このフラグはバンク アングルの角度をスケールする係数を指定します。
デフォルトは 1.0 です。
照会すると float を返します。
bankThreshold(bt) angle query
このフラグはバンク アングルの限度を指定します。
デフォルトは 90° です。
照会すると angle を返します。
curve(c) string query
このフラグはパスのカーブの名前を指定します。
デフォルトは NONE です。
照会すると string を返します。
follow(f) boolean query
true に設定すると、移動オブジェクトの前軸の位置が揃います。
デフォルトは false です。
照会すると boolean を返します。
followAxis(fa) string query
このフラグはパス カーブの接線にアラインする、オブジェクトのローカル軸を指定します。
デフォルトは y です。
照会すると string を返します。
fractionMode(fm) boolean query
true に設定すると、パス カーブの長さの一部に基づいてパスが評価されます。
デフォルトは false です。
照会すると boolean を返します。
inverseUp(iu) boolean query
このフラグは移動オブジェクトのアップ軸をパス ジオメトリの法線ベクトルと反対方向にアラインするかどうかを指定します。
デフォルトは false です。
照会すると boolean を返します。
inverseFront(inverseFront) boolean query
このフラグは移動オブジェクトの前軸をパス ジオメトリの接線ベクトルと反対方向にアラインするかどうかを指定します。
デフォルトは false です。
照会すると boolean を返します。
name(n) string query
このフラグは新しいモーション パス ノードの名前を指定します。 (デフォルト名の代わり)
照会すると string を返します。
upAxis(ua) string query
このフラグは算出された上方向にアラインする、オブジェクトのローカル軸を指定します。
デフォルトは z です。
照会すると string を返します。
useNormal(un) boolean createqueryedit
このフラグは現在ではサポートしていません。-wut/worldUpType を使用してください。
worldUpType(wut) string createqueryedit
ワールド アップ ベクトル計算のタイプを設定します。 worldUpType は、「scene」、「object」、「objectrotation」、「vector」、または「normal」のいずれかです。 「scene」の場合、upVector はシーンのアップ軸にアラインされ、worldUpVector および worldUpObject は無視されます。 「object」の場合、upVector は worldUpObject の空間の原点にできるだけ近い位置に配置され、worldUpVector は無視されます。 「objectrotation」の場合、worldUpVector は worldUpObject の座標空間にあるものと解釈され、ワールド空間にトランスフォームされて upVector はその結果にできるだけ近くアラインされます。 「vector」の場合、upVector は worldUpVector にできるだけ近くアラインされ、worldUpObject は無視されます。 値を「normal」にすると、upVector がパス ジオメトリにアラインされます。 デフォルトの worldUpType は「vector」です。
worldUpVector(wu) [float, float, float] createqueryedit
ワールド アップ ベクトルを設定します。これは、アップ ベクトルとアラインする必要のあるワールド座標内のベクトルです。 詳細については、-wut/worldUpType を参照してください。 作成時に指定していない場合、デフォルト値の(1.0, 0.0, 0.0)が使用されます。
worldUpObject(wuo) name createqueryedit
DAG オブジェクトを worldUpType の「object」および「objectrotation」で使用するように設定します。詳細については、-wut/worldUpType を参照してください。 デフォルト値は、ワールド空間座標として解釈される非アップ オブジェクトです。
startU(su) float query
アニメーションの U パラメータ配置の開始値を指定します。
デフォルトは、カーブのパラメータ配置の開始値です。
照会すると linear を返します。
endU(eu) float query
アニメーションの U パラメータ配置の終了値を指定します。
デフォルトは、カーブのパラメータ配置の終了値です。
照会すると linear を返します。
startTimeU(stu) time querymultiuse
アニメーションの U パラメータの開始時間を指定します。
デフォルトは現在の時間です。
照会すると time を返します。
endTimeU(etu) time querymultiuse
アニメーションの U パラメータの終了時間を指定します。
デフォルトは none です。
照会すると time を返します。

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

Python 例

import maya.cmds as cmds

# Create a set of simple objects for the motion path animation

# create a path, e,g, a curve
path = cmds.curve(d=3,p=[(-10, 0, 0),(-6, 0, 10),(-3, 0, -10),(10, 0, 0)],k=[0, 0, 0, 1, 1, 1])

# create an object, e.g. a sphere
object = cmds.sphere()
cmds.scale( 0.5, 2.0, 0.2 )

# 1. To animate the sphere along the curve, with one keyframe at
# the current time:

cmds.pathAnimation( object[0], c=path )

# or:

cmds.select( object[0], path )
cmds.pathAnimation()

# 2. To animate the sphere along the curve, from time 0 to time 30:

cmds.pathAnimation( object[0], stu=0, etu=30, c=path )

# 3. To align the sphere to its path:

cmds.pathAnimation( object[0], stu=0, etu=30, follow=True, c=path )

# 4. To align the Z axis of sphere to the tangent of the curve, and
# to align the Y axis of the sphere to the up direction of the
# motion curve:

cmds.pathAnimation( object[0], stu=0, etu=30, fa='z', ua='y', c=path )

# 5. To align the Z axis of sphere to the tangent of the motion curve,
# to align the Y axis of sphere to the up direction of the motion
# curve, and to bank with the curvature of the motion curve:

cmds.pathAnimation( object[0], stu=0, etu=30, fa='z', ua='y', bank=True, c=path )

# 6. To change the setting on the bankScale for the motionPath1
# to negative 2.5 (i.e. bank out and multiply the computed
# bank value by 2.5):

cmds.pathAnimation( 'motionPath1', edit=True, bankScale=-2.5 )

# Notes:
# If the computed bank angles are not large enough, the user can
# specify the bankScale to amplify them. The default value is 1.

# Positive bankScale produces inward bank angle,
# negative bankScale produces outward bank angle.

# The user can also change the maximum bank angle through
# the bankThreshold option. Default value is 90 degrees.