Spaces:
Running
Running
File size: 434 Bytes
0b12ad4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import { AnimationMixer } from 'https://unpkg.com/[email protected]/build/three.module.js';
function setupModel(data) {
const model = data.scene.children[0];
if (data.animations.length >= 1) {
const clip = data.animations[0];
const mixer = new AnimationMixer(model);
const action = mixer.clipAction(clip);
action.play();
model.tick = (delta) => mixer.update(delta);
}
return model;
}
export { setupModel };
|