説明:
次の例では、インテグレータ インタフェースの proceedSynch メソッドを使用した 2 つの PF_Source のパーティクル位置の違いを示しています。
用途:
これら 2 つのサンプル スクリプトは、Script_Test アクションの内部で使用されます。
ビューポートで PF_Source を作成します。
[パーティクル ビュー]を開きます。
[Event01]の最後に Script_Test アクションを追加します。
パーティクル システムのクローンを作成しますが、まったく同じ位置に置いたままにしておきます。
2 つ目のパーティクル システムのカラーを変更します。
最初のパーティクル システムの Script_Test テストにある最初のサンプルをロードします。
2 つ目のパーティクル システムの Script_Test テストにある 2 つ目のサンプルをロードします。
効果:
ユーザが、2 つの ProceedSynch コールの効果を比較できます。
すべてのパーティクルの位置の結果が、リスナーに印刷されます。
例 1
--The ChannelsUsed handler defines the channels --to be made available to the script. --For the list of all channels, see --Interface: MaxscriptParticleContainer --The parameter pCont passed to the handler --contains the Particle Container the script is applied to on ChannelsUsed pCont do ( pCont.useTime = true --enable the Time channel pCont.usePosition = true --enable the Position channel ) --The Init handler is called on initialization. --It is not used in this case. on Init pCont do ( ) --In the Proceed handler, we will call the ProceedSync method --of the integrator. on Proceed pCont do ( end = pCont.GetTimeEnd() as float _int = pCont.GetIntegrator() count = pCont.NumParticles() pCont_curr = pCont.GetParticleContainer() for i in 1 to count do ( pCont.particleIndex = i if _int != undefined then _int.proceedSync pCont_curr (end/160) 0.0 false #{} format "p1.particle%=%\n" i (pCont.GetParticlePosition i) ) ) --The Release handler is used to do cleanup work. --Not used in this case. on Release pCont do ( )
例 2
--The ChannelsUsed handler defines the channels --to be made available to the script. --For the list of all channels, see --Interface: MaxscriptParticleContainer --The parameter pCont passed to the handler --contains the Particle Container the script is applied to on ChannelsUsed pCont do ( pCont.useTime = true --enable the Time channelpCont.usePosition = true --enable the Position channel ) --The Init handler is called on initialization. --It is not used in this case. on Init pCont do ( ) on Proceed pCont do ( end = pCont.GetTimeEnd()asfloat_int = pCont.GetIntegrator() count = pCont.NumParticles()pCont_curr = pCont.GetParticleContainer() for i in 1 to count do ( pCont.particleIndex = i if _int != undefined then _int.proceedSync pCont_curr (end/160) 0.5 false #{} -- Array version to try out: --_int.proceedASync pCont_curr #((end/160), (2*end/160), (3*end/160)) #(0.1, 0.2, 0.5) true #{1..3} format "p2.particle%=%\n" i (pCont.GetParticlePosition i) ) ) --The Release handler is used to do cleanup work. --Not used in this case. on Release pCont do ( )