Path_Constraint - superclass: PositionController

Path_Constraint - superclass: PositionController; super-superclass:MAXWrapper - 12:0 - classID: #(8209, 0)

パス コンストレイントは、オブジェクトの動作を特定のスプラインに沿うように制限したり、複数のスプライン間の距離を一定に保つように制限したりします。

コンストラクタ

Path_Constraint ... path ...

プロパティ

<Path_Constraint>.path UndefinedClass default: undefined -- node; Path_Constraint

制限先にするパスのリストの最初のパスを取得/設定します。

注:

このプロパティは主に、Path_Constraint が導入される前の 3ds Max バージョン 4 よりも前に使用されていた従来の Path Position Controller との下位互換を目的として公開されています。従来のコントローラでは、.path プロパティによって取得および設定される 1 つのパスだけがサポートされていました。

Path_Constraint の .path プロパティは、常にパスのリストの最初のオブジェクトを返します。

.path プロパティを設定すると、必ず、リスト上の最上位のパスが新しいものに置き換えられます。

リスト上に複数のオブジェクトがあり、.path プロパティに割り当てられているオブジェクトがリスト上に既に存在しているものの、そのオブジェクトが最初のオブジェクトでない場合は、リスト上の最初のエントリが新しいオブジェクトに置き換えられます。また、パスはリスト上に一度しか存在できないため、2 つ目のエントリは削除されます。°

複数のパスを設定および管理するためには、このトピックでこの後説明する constraints インタフェースによって公開されるメソッドを使用します。

<Path_Constraint>.percent Float default: 0.0 -- animatable; percentage

指定した軌道とオブジェクト移動の合致率を設定します。[パスに沿った %] (% Along Path)スピナーに対応します。

<Path_Constraint>.follow Boolean default: false -- boolean

1 つのオブジェクト軸を現在の位置でスプラインに沿って接線に位置合わせします。追随する軸を指定するには、.axis および .axisflip プロパティを使用します。

<Path_Constraint>.bank Boolean default: false -- boolean

オブジェクトがスプラインのカーブを通り抜けるときにバンク(追随軸を回転)するようにします。このプロパティは、.follow プロパティが true に設定されている場合にのみ有効です。 バンク時に回転する軸は、追随動作の場合と同じです。

<Path_Constraint>.bankAmount Float default: 0.5 -- animatable; float; Bank_Amount

値の正負に応じて、軌道の内側または外側にオブジェクト移動が外れる幅を指定します。

<Path_Constraint>.smoothness Float default: 0.5 -- animatable; float

オブジェクトが軌道に沿って傾くときの、傾斜角度が変化する速さをコントロールします。小さめの値を設定すると、カーブの微妙な変化がオブジェクトの移動に反映されます。大きめの値を設定すると、スムーズな移動が優先されます。既定値では、微妙な変化はある程度まで反映されます。この編集ボックスに 2 未満の値を設定すると、通常はオブジェクトの移動がぎこちなくなります。3 前後の値を設定すると、動きに多少の不安定さが生まれ、より写実的な効果を得ることができます。

<Path_Constraint>.allowUpsideDown Boolean default: false -- boolean; Allow_Upside_Down

垂直な軌道でオブジェクトが反転する状況を回避する場合は true にします。

<Path_Constraint>.constantVel Boolean default: false -- boolean; Constant_Velocity

true に設定した場合は、パス長さ補間を使用してパスに沿った速度を一定にします。false に設定した場合は、オブジェクトの移動速度はパス上の頂点間の距離によって決定されます。

2 つの補間方法については、「SplineShape - 頂点補間と長さ補間 の注および例」を参照してください。

<Path_Constraint>.loop Boolean default: true -- boolean

false に設定すると、制限されたオブジェクトは、パスの終点に達すると終点を超えて移動することはできません。true (既定値)に設定すると、コンストレイントされたオブジェクトがパスの終点に達したとき、始点に戻ってループします。

<Path_Constraint>.relative Boolean default: false -- boolean

true に設定すると、コンストレイントされたオブジェクトは元の位置のままになります。このオブジェクトは、元のワールド空間位置に基づいて、オフセット距離を保ちながら (1 つまたは複数の) パスを移動します。false (既定値)に設定されている場合は、オブジェクトはパスの位置、または複数のパスの間の重み付きの位置に移動されます。

<Path_Constraint>.axis Integer default: 0 -- integer

.follow プロパティが true に設定されている場合に、オブジェクトのどの軸をパスの接線に位置合わせするかを取得/設定します。

有効な値は次のとおりです。

0 - X 軸

1 - Y 軸

2 - Z 軸

<Path_Constraint>.axisFlip Boolean default: false -- boolean; Axis_Flip

false に設定されている場合は、.axis プロパティによって指定されている軸が使用されます。true に設定されている場合は、.axis プロパティによって指定されている軸に負符号が付加されます(反転されます)。

Path_Constraint インタフェース:

Interface:constraints

メソッド

<integer>getNumTargets ()

ターゲット リスト内のターゲット ノード (パス) の数を返します。

<node>getNode <index>targetNumber

パスのリストから、インデックスで指定されたノードを返します。

<float>getWeight <index>targetNumber

ターゲットのリストから、インデックスで指定されたパスノードの重みを取得します。targetNumber がターゲット数よりも小さい場合は現時点でのターゲットの重みの値を返し、それ以外の場合には 0.0 を返します。

<boolean>setWeight <index>targetNumber<float>weight

targetNumber で指定されたインデックス付きノードの重みを指定された値に設定します。成功した場合は true、成功しなかった場合は false を返します。

<boolean>appendTarget <node>target<float>weight

指定したノードをリストに追加します。既定の重みは 50.0 です。成功した場合は true、失敗した場合は false を返します。

<boolean>deleteTarget <index>targetNumber

インデックスで指定されたターゲットを削除します。成功した場合は true、成功しなかった場合は false を返します。

パス ターゲット オブジェクトに関する注:

任意のタイプのシェイプをパス ターゲットにできます。スプライン カーブ (ターゲット) には、コンストレイントされるオブジェクトの軌道を定義します。ターゲットは、変換、回転、スケールといった標準ツールでアニメートできます。

パスのサブオブジェクト レベル (頂点、セグメント、またはモディファイヤおよびスペース ワープを使用したパスの変形) にキーを設定することによって、コンストレイントされたオブジェクトに影響を与えながらパスをアニメートすることができます。

シェイプに複数のスプラインが含まれている場合 (ドーナツ シェイプなど) は、シェイプの最初のスプラインが使用されます。

    path1 = Circle()--create a circular path
    --> $Circle:Circle001 @ [0.000000,0.000000,0.000000]
    path2 = Ellipse length:20 width:200--create another path
    --> $Ellipse:Ellipse001 @ [0.000000,0.000000,0.000000]
    s = sphere radius:5--create a sphere
    --> $Sphere:Sphere001 @ [0.000000,0.000000,0.000000]
    pc = path_constraint()--create a path constraint
    --> Controller:Path_Constraint
    s.position.controller = pc--assign it to the sphere's position
    --> Controller:Path_Constraint
    pc.path = path1--assign the first path to the path property
    --> $Circle:Circle001 @ [0.000000,0.000000,0.000000]
    pc.path = path2--assign the second path - it replaces the first
    --> $Ellipse:Ellipse001 @ [0.000000,0.000000,0.000000]
    pc.appendTarget path2 50--try to append the second path
    --> false--you cannot because it is already assigned!
    pc.appendTarget path1 50--try to append the first path
    --> true--you can because it was not assigned to the list yet
    pc.getNumTargets()--see how many paths there are on the list
    --> 2
    pc.getWeight 1--get the weight of the first path
    --> 50.0
    pc.getWeight 2--get the weight of the first path
    --> 50.0
    pc.getWeight 3--get the weight of thethirdpath
    --> 0.0--returns zero because there is no such path!
    pc.setWeight 1 100--set the weight of the first path to 100
    --> true--success, the sphere moves closer to the ellipse
    pc.setWeight 2 0--set the weight of the second path to 0
    --> true--success, the sphere moves to the ellipse
    pc.path = path1--try to assign the circle to the path
    --At this point, the Circle replaces the Ellispe on the list,
    --and the second entry which used to be the Circle is removed
    --because "There can be only one"!
    --> $Circle:Circle001 @ [0.000000,0.000000,0.000000]
    pc.deleteTarget 2--try to delete the second path
    --> false--you cannot, there is no second path anymore
    pc.deleteTarget 1--try to delete the first path (the Circle)
    --> true