GltfModel
商品説明
このコンポーネントは、エンティティにカスタムジオメトリを確立する。
プロパティ一覧
Property | Type | 初期値 | 商品説明 |
---|---|---|---|
url (必須) | ストリング | "" | ソースのURL。 |
アニメーションクリップ | ストリング | "" | 再生するモデルに付けられたanimationClipの名前。 ワイルドカード * も使用でき、すべてのアニメーションを再生するようにモデルを設定します。 |
ループ | ブーリアン | false | アニメーションクリップが再生終了後に再スタートするかどうか |
休止中 | ブーリアン | false | アニメーションクリップを一時停止するかどうか |
時間 | 番号 | 0 | animationClipにジャンプする時間(秒 |
時間スケール | 番号 | 1 | 時間のスケーリング係数。 0はアニメーションを一時停止する。 負の値は、アニメーションを逆再生します。 |
コライダー | ブーリアン | false | アニメーションが物理コライダーを更新するかどうか。 |
リバース | ブーリアン | false | 設定された場合、アニメーションは順方向の再生が終わると逆方向に再生されます。 |
はんぷく | 番号 | -1 | loop' と一緒に設定した場合、ループの繰り返し回数 (-1 は永久ループを意味する) |
クロスフェード時間 | 番号 | 0 | 新しいアニメーションが開始されたとき(既存のアニメーションが再生されているとき)、アニメーション間のブレンドに費やされる時間(秒)。 |
関数一覧
Get
Returns a read-only reference.
Example
ecs.GltfModel.get(world, component.eid)
Set
Ensures the component exists on the entity, then assigns the (optional) data to the component.
Example
ecs.GltfModel.set(world, component.eid, {
url: './assets/doty.glb',
animationClip: 'idle',
loop: false,
paused: false,
time: 0,
timeScale: 1,
collider: false,
reverse: false,
repetitions: -1,
crossFadeDuration: 0
})
Mutate
Perform an update to the component within a callback function. Return true
to indicate no changes made.
Example
ecs.GltfModel.mutate(world, component.eid, (cursor) => {
cursor.timeScale = 0.5;
cursor.loop = true;
return false;
})
Remove
Removes the component from the entity.
Example
ecs.GltfModel.remove(world, component.eid)
Has
Returns true
if the component is present on the entity.
Example
ecs.GltfModel.has(world, component.eid)
Reset
Adds, or resets the component to its default state.
Example
ecs.GltfModel.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.GltfModel.cursor(world, component.eid)
Acquire
Same behavior as cursor, but commit must be called after the cursor is done being used.
Example
ecs.GltfModel.acquire(world, component.eid)