Skip to content
Merged
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ <h2 style="margin: 0; font-size: 1.2rem">Help</h2>
For another scene, you probably want to set it to a higher value.
-->
<a-assets timeout="30000">
<a-asset-item id="sceneGLB" src="./hubs_components_example_002.glb"></a-asset-item>
<a-asset-item id="sceneGLB" src="./hubs_components_example_004.glb"></a-asset-item>
</a-assets>
<a-entity
id="rig"
Expand Down
14 changes: 12 additions & 2 deletions src/components/gltf-model-plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ export const gltfModelPlus = {
for (let i = 0; i < clipNames.length; i++) {
const n = clipNames[i];
const a = animations.find(({ name }) => name === n);
// Add the Hubs defined componentProps, we need them later.
a.componentProps = componentProps;
if (a) {
clips.push(a);
} else {
Expand All @@ -316,9 +318,17 @@ export const gltfModelPlus = {
}
}

for (let i = 0; i < clips.length; i++) {
const action = self.mixer.clipAction(clips[i], node);
for (const clip of clips) {
const action = self.mixer.clipAction(clip, node);
action.enabled = true;
// If timeScale is set, use it.
if (clip.componentProps.timeScale !== 1) {
action.timeScale = clip.componentProps.timeScale;
}
// If startOffset is set, use it.
if (clip.componentProps.startOffset !== 0) {
action.time = clip.componentProps.startOffset;
}
action.setLoop(THREE.LoopRepeat, Infinity).play();
}
} else {
Expand Down