LlParticleSystem/ja

From Second Life Wiki
< LlParticleSystem
Revision as of 23:27, 9 January 2008 by Asuka Neely (talk | contribs) (New page: {{multi-lang}}{{LSL Function/color/ja}}{{LSL Function/alpha/ja}}{{LSL_Function/ja |func_id=229|func_sleep=0.0|func_energy=10.0 |func=llParticleSystem |p1_type=list |p1_name=rules |p1_desc=...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

要約

関数: llParticleSystem( list <span title="パーティクルシステムルール一覧のフォーマット
[ rule1, data1, rule2, data2 . . . ルール、データ ]" style="border-bottom:1px dotted; cursor:help;">rules
);

ルールの一覧が組まれているプリムを含んでいるパーティクルシステムを定義します。

• list rules パーティクルシステムルール一覧のフォーマット
[ rule1, data1, rule2, data2 . . . ルール、データ ]

仕様

プリム内にあるスクリプトに含まれているパーティクルエミッターの状態を設定するパーティクルシステムを定義します。この関数を同じプリムにあるいずれか他のスクリプトが呼んでいる場合、同一のパーティクルエミッターの状態として修正するでしょう。 各プリムは幾何学中心を中心とした、ひとつのパーティクルエミッターのみ所有でき、 プリムの有効なZ方向に指向する、ローカルZ軸に沿って並びます。

この関数は、プリムのパーティクルエミッターの状態を更新するだけのものです。エミッターを異なる状態に変更したいなら(たとえば、異なるパーティクルシステム全体を分散させる、あるいはエミッターを完全にオフにする)、 代わりに描写したい新しいパーティクルシステムのパラメータでこの関数を呼ぶだけです。空のリストを指定するとエミッターはオフに切り替わります。

パーティクルは基本的に2Dのスプライトで、常にビューアのカメラ表面に描写されます。

ルール/データは以下に定義されます。

Rule / Value Constant Type Description Value
System Behavior
PSYS_PART_FLAGS integer}} hexadecimal|hex}} format, or by ORing together (using the | operator) one or more of the following flag constants: 0
V
a
l
u
e
s
PSYS_PART_BOUNCE_MASK When set, specifies particles will bounce off a plane at the region Z height of the emitter. On "bounce", each particle reverses velocity and angle. This only works for particles above the plane falling down on it. 0x004
PSYS_PART_EMISSIVE_MASK When set, particles are full-bright and are unaffected by global lighting (sunlight). Otherwise, particles will be lit depending on the current global lighting conditions. Note that point lights do illuminate non-emissive particles. 0x100
PSYS_PART_FOLLOW_SRC_MASK When set, particles move relative to the position of the emitter. Otherwise, particle position and movement are unaffected by the position/movement of the emitter. This flag disables the PSYS_SRC_BURST_RADIUS rule. 0x010
PSYS_PART_FOLLOW_VELOCITY_MASK When set, particles rotate to orient their "top" towards the direction of movement or emission. Otherwise, particles are always emitted based on the current rotation of the emitter. 0x020
PSYS_PART_INTERP_COLOR_MASK When set, particle color and alpha transition from their START settings to their END settings during the particle's lifetime. The transition is a smooth interpolation. 0x001
PSYS_PART_INTERP_SCALE_MASK When set, particle size/scale transitions from its START setting to its END setting during the particle's lifetime. 0x002
PSYS_PART_TARGET_LINEAR_MASK (not officially documented) When set, emitted particles move in a straight line towards the target specified by the PSYS_SRC_TARGET_KEY rule. In this mode, PSYS_SRC_ACCEL, PSYS_SRC_BURST_RADIUS, and possibly other rules are ignored. 0x080
PSYS_PART_TARGET_POS_MASK When set, emitted particles change course during their lifetime, attempting to move towards the target specified by the PSYS_SRC_TARGET_KEY rule by the time they expire. Note that if no target is specified, the target moves out of range, or an invalid target is specified, the particles target the prim itself. 0x040
PSYS_PART_WIND_MASK llWind|wind}}. It is applied as a secondary force on the particles. 0x008
PSYS_PART_BEAM_MASK (unimplemented) mask but in the enum 0x200
PSYS_PART_DEAD_MASK Removes particles, not compatible with any other PSYS_PART_*_MASK 0x80000000
PSYS_PART_RANDOM_ACCEL_MASK (unimplemented) Presumed to be used to apply random acceleration to the particles. -
PSYS_PART_RANDOM_VEL_MASK (unimplemented) Presumed to be used to specify random velocity for the particles upon emission. -
PSYS_PART_TRAIL_MASK (unimplemented) Presumed to be used for implementing "trails" via emitting more particles at shorter bursts. -
System Presentation
PSYS_SRC_PATTERN integer}} Specifies the general emission pattern. 9
V
a
l
u
e
s
PSYS_SRC_PATTERN_ANGLE Present particles in a 2-dimensional circular section as defined by PSYS_SRC_ANGLE_BEGIN and PSYS_SRC_ANGLE_END. The orientation of the particle plane is at X=0 relative to the emitter's region rotation. 0x04
PSYS_SRC_PATTERN_ANGLE_CONE Present particles in a 3-dimensional spherical section, as defined by PSYS_SRC_ANGLE_BEGIN and PSYS_SRC_ANGLE_END. 0x08
PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY (not officially documented; appears to be non-functional) Present particles in a 3-dimensional spherical section, as defined by PSYS_SRC_ANGLE_BEGIN and PSYS_SRC_ANGLE_END, but inversely compared to the ANGLE_CONE pattern (i.e., where there were voids in ANGLE_CONE, there are particles in ANGLE_CONE_EMPTY, and vice-versa. 0x10
PSYS_SRC_PATTERN_DROP Present particles by dropping them at the emitter position with no force. Ignores the PSYS_SRC_BURST_RADIUS, PSYS_SRC_BURST_SPEED_MIN, and PSYS_SRC_BURST_SPEED_MAX rules. 0x01
PSYS_SRC_PATTERN_EXPLODE Present particles by shooting them out in all directions according to the burst motion rules. 0x02
PSYS_SRC_BURST_RADIUS float}} Specifies the distance from the emitter where particles will be created. This rule is ignored when the PSYS_PART_FOLLOW_SRC_MASK flag is set. A test in http://forums.secondlife.com/showthread.php?t=226722 indicates that the maximum value is 50.00 16
PSYS_SRC_ANGLE_BEGIN float}} Specifies a half angle, in radians, of a circular or spherical "dimple" or conic section (starting from the emitter facing) within which particles will NOT be emitted. Valid values are the same as for PSYS_SRC_ANGLE_END, though the effects are reversed accordingly. If the pattern is PSYS_SRC_PATTERN_ANGLE, the presentation is a 2D flat circular section. If PSYS_SRC_PATTERN_ANGLE_CONE or PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY is used, the presentation is a 3D spherical section. Note that the value of this parameter and PSYS_SRC_ANGLE_END are internally re-ordered such that this parameter gets the smaller of the two values. 22
PSYS_SRC_ANGLE_END float}} Specifies a half angle, in radians, of a circular or spherical "dimple" or conic section (starting from the emitter facing) within which particles will NOT be emitted. Valid values are 0.0, which will result in particles being emitted in a straight line in the direction of the emitter facing, to PI, which will result in particles being emitted in a full circular or spherical arc around the emitter, not including the "dimple" or conic section defined by PSYS_SRC_ANGLE_BEGIN. If the pattern is PSYS_SRC_PATTERN_ANGLE, the presentation is a 2D flat circular section. If PSYS_SRC_PATTERN_ANGLE_CONE or PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY is used, the presentation is a 3D spherical section. Note that the value of this parameter and PSYS_SRC_ANGLE_BEGIN are internally re-ordered such that this parameter gets the larger of the two values. 23
PSYS_SRC_INNERANGLE float}} DEPRECATED: Use PSYS_SRC_ANGLE_BEGIN instead. Works similar to its replacement rule, except the edge of the section is aligned with the emitter facing, rather than its center. 10
PSYS_SRC_OUTERANGLE float}} DEPRECATED: Use PSYS_SRC_ANGLE_END instead. Works similar to its replacement rule, except the edge of the section is aligned with the emitter facing, rather than the section's center. 11
PSYS_SRC_TARGET_KEY key}} Specifies the key of a target object, prim, or agent towards which the particles will change course and move. They will attempt to end up at the geometric center of the target at the end of their lifetime. Requires the PSYS_PART_TARGET_POS_MASK flag be set. caveat 4 20
Particle Appearance
PSYS_PART_START_COLOR vector}} unit vector}} specifying the {{LSLG|color}} of the particles upon emission. 1
PSYS_PART_END_COLOR vector}} unit vector}} specifying the {{LSLG|color}} the particles transition to during their lifetime. Only used if the PSYS_PART_INTERP_COLOR_MASK flag is set. 3
PSYS_PART_START_ALPHA float}} alpha}} of the particles upon emission. Valid values are in the range 0.0 to 1.0. Higher values are more opaque; lower ones are more transparent. 2
PSYS_PART_END_ALPHA float}} alpha}} the particles transition to during their lifetime. Only used if the PSYS_PART_INTERP_COLOR_MASK flag is set. Valid values are the same as PSYS_PART_START_ALPHA. (caveat 1) 4
PSYS_PART_START_SCALE vector}} scale}} or size of the particles upon emission. Valid values for each direction are 0.04 (0.03125) to 4.0, in meters. Since particles are essentially 2D sprites, the Z component of the vector is ignored and can be set to 0.0. 5
PSYS_PART_END_SCALE vector}} scale}} or size the particles transition to during their lifetime. Only used if the PSYS_PART_INTERP_SCALE_MASK flag is set. Valid values are the same as PSYS_PART_START_SCALE. 6
PSYS_SRC_TEXTURE string}} Specifies the name of a texture in the prim's inventory to use for each particle. Alternatively, you may specify an asset key UUID for a texture. 12
Particle Flow
PSYS_SRC_MAX_AGE float}} Specifies the length of time, in seconds, that the emitter will operate upon coming into view range (if the particle system is already set) or upon execution of this function (if already in view range). Upon expiration, no more particles will be emitted, except as specified above. Zero will give the particle system an infinite duration. (caveat 2) 19
PSYS_PART_MAX_AGE float}} Specifies the lifetime of each particle emitted, in seconds. Maximum is 30.0 seconds. During this time, the particle will appear, change appearance and move according to the parameters specified in the other sections, and then disappear. 7
PSYS_SRC_BURST_RATE float}} Specifies the time interval, in seconds, between "bursts" of particles being emitted. Specifying a value of 0.0 will cause the emission of particles as fast as the viewer can do so. 13
PSYS_SRC_BURST_PART_COUNT integer}} Specifies the number of particles emitted in each "burst". 15
Particle Motion
PSYS_SRC_ACCEL vector}} Specifies a directional acceleration vector applied to each particle as it is emitted, in meters per second. Valid values are 0.0 to 100.0 for each direction, as region coordinates. 8
PSYS_SRC_OMEGA vector}} llTargetOmega}}) has no effect on emitter spin. (caveat 3) 21
PSYS_SRC_BURST_SPEED_MIN float}} Specifies the minimum value of a random range of values which is selected for each particle in a burst as its initial speed upon emission, in meters per second. Note that the value of this parameter and PSYS_SRC_BURST_SPEED_MAX are internally re-ordered such that this parameter gets the smaller of the two values. 17
PSYS_SRC_BURST_SPEED_MAX float}} Specifies the maximum value of a random range of values which is selected for each particle in a burst as its initial speed upon emission, in meters per second. Note that the value of this parameter and PSYS_SRC_BURST_SPEED_MIN are internally re-ordered such that this parameter gets the larger of the two values. 18

警告

  1. パーティクルシステム実行によるバグ(VWR-2146参照)のようで、、PSYS_PART_END_ALPHAとPSYS_PART_INTERP_COLOR_MASKフラグは、常に補正された結果としてPSYS_PART_END_ALPHAの値を加えるでしょう。そして1から初めて0.5進めるなら、パーティクルの効果時間の半分のとき0.75のアルファを期待します。1.25になろうとするとバグが発生します。結果的に、いつも加えられた後にこれの必要とする数値より高めに設定にするなどすれば、パーティクルが消滅しなくなります。
    • これは WindLight First Look test Viewerにて修正されています。
  2. 0ではないエミッター効果時間(PSYS_SRC_MAX_AGE) の設定にてパーティクルシステムを使っているとき、パーティクルシステムで組まれたトリガがオフになることなく再起動するかもしれない、と伝えるほうがいいかもしれません。これはエミッターが幾つかのプリムの設定が更新もしくは他のビューアに送信するときにリセットするのが原因でバグが発生しているようです。結果的に、timerを使うか、著しい遅延と一度発生時間を消滅させてパーティクルシステムを消すべきかもしれません。
  3. PSYS_SRC_OMEGAで定義される回転は、リージョン座標システムに相対的で、プリムのローカル座標システムとは相対的ではありません。
  4. パーティクルは、PSYS_SRC_TARGET_KEYルールとPSYS_PART_TARGET_POS_MASKフラグで設定されている、指定された人型アバタに向かって動いていて、終点はアバターの矩形の幾何学中心、あいにくにも、アバタの股間部に直撃しているように表示されるでしょう。対象のアバタのほかの箇所を終点にしたい場合は、代わりに終点にしたい場所にした対象プリムを設置すべきで、PSYS_SRC_TARGET_KEYルールの値にそのプリムのキーを使用します。
  5. Second Life viewerは余りにも小さくみえる距離にあるオブジェクトは淘汰するように最適化されています。もしエミッターがとても小さいなら、距離のことがもとで最適化され、パーティクルシステムとそのエミッター間で表示されないでしょう。
All Issues ~ Search JIRA for related Bugs

サンプル

Example Particle Script/ja


この例は光っている赤い球の効果を作成します。 <lsl>

       llParticleSystem( 
[PSYS_PART_FLAGS, PSYS_PART_WIND_MASK

便利なスニペット

integerに(から)色とアルファの値を蓄積(回収)のための使い勝手のいい関数です。
<lsl> integer ColorAlphatoRGBA(vector color, float alpha) { return (((integer)(alpha * 255.0) & 0xFF) << 24)

注意点

  • The default particle count for the client is normally set at 4096. That is the max particle count the client will render for ALL active particle systems within view range. Good particle system design is key to avoid "spamming" everyone with your particles, and starving out other people's particle systems. As such, if you are experiencing trouble getting your particle emitter to emit as many particles as you like, it may be the victim of particle starvation. Client/viewer lag (low frame rates) can also cause this issue, as particles are a rather low priority for rendering. The best solution for this is to move to a less laggy environment relatively free of other particle systems when designing and testing your own.
  • Once particles are emitted, their direction of motion can only be affected by PSYS_SRC_ACCEL, the PSYS_PART_TARGET_POS_MASK flag, or the PSYS_PART_FOLLOW_SRC_MASK flag. As such, there is no good way to create the "swirling vortex" effect (like the one used in the viewer to indicate an object talking, begin derezzed, or when an avatar leaves the sim/grid).

関連項目

記事

•  LSL での色
•  透明度

特記事項

Search JIRA for related Issues

Signature

function void llParticleSystem( list rules );
この翻訳は 原文 と比べて古いですか?間違いがありますか?読みにくいですか?みんなで 修正 していきましょう! (手順はこちら)
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。