ジャンプ先: 概要. 戻り値. フラグ. 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.