メインコンテンツへスキップ

GltfModel

商品説明

このコンポーネントは、エンティティにカスタムジオメトリを確立する。

プロパティ一覧

PropertyType初期値商品説明
url (必須)ストリング""ソースのURL。
アニメーションクリップストリング""再生するモデルに付けられたanimationClipの名前。 ワイルドカード * も使用でき、すべてのアニメーションを再生するようにモデルを設定します。
ループブーリアンfalseアニメーションクリップが再生終了後に再スタートするかどうか
休止中ブーリアンfalseアニメーションクリップを一時停止するかどうか
時間番号0animationClipにジャンプする時間(秒
時間スケール番号1時間のスケーリング係数。 0はアニメーションを一時停止する。 負の値は、アニメーションを逆再生します。
コライダーブーリアンfalseアニメーションが物理コライダーを更新するかどうか。
リバースブーリアンfalse設定された場合、アニメーションは順方向の再生が終わると逆方向に再生されます。
はんぷく番号-1loop' と一緒に設定した場合、ループの繰り返し回数 (-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)

Commit

Called after acquire. An optional third argument determines whether the cursor was mutated or not.

Example
ecs.GltfModel.commit(world, component.eid)
ecs.GltfModel.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.GltfModel.dirty(world, component.eid)