パーティクルエミッター
商品説明
このコンポーネントは、エンティティにパーティクルを放出させます。
プロパティ一覧
Property | Type | 初期値 | 商品説明 |
---|---|---|---|
停止 | ブーリアン | false | エミッターの再生状態 |
エミッターライフ | 番号 | 0 | エミッターの寿命(秒 |
パーティクルパーショット | integer | 20 | 排出あたりの粒子数 |
発光遅延 | 番号 | 0.1 | パーティクルが放出されるまでの時間 |
最低寿命 | 番号 | 1 | 各パーティクルの最小寿命範囲 |
最大寿命 | 番号 | 1 | 各パーティクルの最大寿命範囲 |
質量 | 番号 | 1 | 各粒子の質量 |
重力 | 番号 | 0.2 | 各粒子の重力係数 |
scale | 番号 | 0.2 | 各粒子の均一なスケール |
フォースエックス | 番号 | 5 | 各粒子にX 方向にかかる力 |
フォースワイ | 番号 | 12 | 各パーティクルにかかるY方向の力 |
フォースZ | 番号 | 5 | 各粒子にZ方向にかかる力 |
広がり | 番号 | 360 | 各パーティクルが原点に対して相対的にスポーンするエリアと方向 |
ラジアル速度 | 番号 | 5 | 各粒子に適用される半径方向速度の量 |
スポーンエリアタイプ | ストリング | ポイント | サポートされているタイプは以下の通り: 点'、'箱'、'球' |
スポーンエリア幅 | 番号 | 0 | スポーンエリアボックスの幅(ボックスのみ) |
スポーンエリア高さ | 番号 | 0 | スポーンエリアボックスの高さ(ボックスのみ) |
スポーンエリアの深さ | 番号 | 0 | スポーンエリア・ボックスの深さ(ボックスのみ) |
スポーンエリア半径 | 番号 | 0 | スポーンエリア球体の半径(球体のみ) |
boundingZoneType | ストリング | 'なし' | サポートされているタイプは以下の通り: なし'、'ボックス'、'球' |
バウンディングゾーン幅 | 番号 | 0 | バウンディングゾーンの幅(ボックスのみ) |
バウンディングゾーン高さ | 番号 | 0 | バウンディングゾーンの高さ(ボックスのみ) |
バウンディングゾーンの深さ | 番号 | 0 | バウンディングゾーンの深さ(ボックスのみ) |
バウンディングゾーン半径 | 番号 | 0 | バウンディングゾーンの半径(球のみ) |
リソースタイプ | ストリング | スプライト | サポートされている型は以下の通り: スプライト」、「モデル |
リソースURL | 文字列 (URL) | '' | リソースのURL |
ブレンドモード | ストリング | 'なし' | サポートされるタイプは以下の通り: none」、「normal」、「add」、「multiply」、「subtract」。 |
アニメートカラー | ブーリアン | false | 色をアニメーションさせるかどうかを決定する。 |
カラースタート | 文字列(16進数) | 未定義 | 各パーティクルの開始色 |
カラーエンド | 文字列(16進数) | 未定義 | 各パーティクルのエンディングカラー |
ランダムドリフト | ブーリアン | false | 各パーティクルのランダムドリフトを有効にする |
ランダムドリフトレンジ | 番号 | 未定義 | 各パーティクルのランダムなドリフト範囲と速度を決定します。 |
衝突 | ブーリアン | false | パーティクルが物理衝突に反応するかどうかを決定する。 |
関数一覧
Get
Returns a read-only reference.
Example
ecs.ParticleEmitter.get(world, component.eid)
Set
Ensures the component exists on the entity, then assigns the (optional) data to the component.
Example
ecs.ParticleEmitter.set(world, component.eid, {
stopped: false,
emitterLife: 0,
particlesPerShot: 20,
emitDelay: 0.1,
minimumLifespan: 1,
maximumLifespan: 1,
mass: 1,
gravity: 0.2,
scale: 0.2,
forceX: 5,
forceY: 12,
forceZ: 5,
spread: 360
})
Mutate
Perform an update to the component within a callback function. Return true
to indicate no changes made.
Example
ecs.ParticleEmitter.mutate(world, component.eid, (cursor) => {
cursor.emitDelay = 0.05;
cursor.particlesPerShot = 50;
return false;
})
Remove
Removes the component from the entity.
Example
ecs.ParticleEmitter.remove(world, component.eid)
Has
Returns true
if the component is present on the entity.
Example
ecs.ParticleEmitter.has(world, component.eid)
Reset
Adds, or resets the component to its default state.
Example
ecs.ParticleEmitter.reset(world, component.eid)
Advanced Functions
Cursor
Returns a mutable reference. Cursors are reused so only one cursor for each component can exist at a time.
Example
ecs.ParticleEmitter.cursor(world, component.eid)
Acquire
Same behavior as cursor, but commit must be called after the cursor is done being used.
Example
ecs.ParticleEmitter.acquire(world, component.eid)
Commit
Called after acquire. An optional third argument determines whether the cursor was mutated or not.
Example
ecs.ParticleEmitter.commit(world, component.eid)
ecs.ParticleEmitter.commit(world, component.eid, false)
Dirty
Mark the entity as having been mutated. Only needed in a specific case where systems are mutating data.
Example
ecs.ParticleEmitter.dirty(world, component.eid)