particleFloat サンプル スクリプト

説明:

次のスクリプトでは、各パーティクルの実数値が、パーティクル ID すなわち発生インデックス番号の 1/10 の値に設定されます。

用途:

Force オペレータおよび Speed_Keep_Apart オペレータの .Force 値を制御するために使用できます。

Force : ヘルパー

Speed_Keep_Apart : ヘルパー

効果:

最初のパーティクルは小さい実数値を取得するため[影響] (Influence)値も小さくなります。後続のパーティクルはそれぞれ前のパーティクルよりも大きい実数値を取得します。この結果、パーティクルが後に生成されるほど、オペレータ内のスペース ワープの影響をより多く受けることになります。

    --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.useFloat = true--enable the Float channel
    )

    --The Init handler is called on initialization.
    --It is not used in this case.
    on Init pCont do
    (
    )

    --The Proceed handler contains the main script
    --applied to the Particles.
    --The parameter pCont passed to the handler
    --contains the Particle Container the script is applied to:
    on Proceed pCont do
    (
    --Get the number of particles
    count = pCont.NumParticles()

    --Loop from 1 to the number of particles:
    for i in 1 to count do
    (

    --Set the particle index in the container to the current i value.
    --This makes the i-th particle in the container the current one
    pCont.particleIndex = i

    --Set the particleFloat channel value of the current particle
    --to the particleID of the current particle divided by 10.0.
    --The younger the particle, the higher the particleFloat value.
    pCont.particleFloat = pCont.particleID/10.0
    )--end i loop
    )--end Proceed

    --The Release handler is used to do cleanup work.
    --Not used in this case.
    on Release pCont do
    (
    )