Advertisement
moreiramota

Untitled

Dec 30th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. function criarAnimacao() {
  2. var loader = new THREE.GLTFLoader();
  3. loader.load('../CutleryFatctoryDesign/Utils/ImportObjects/maquinaanimada.gltf', function(gltf) {
  4. var a = 0;
  5. gltf.scene.scale.set(0.1, 0.1, 0.1);
  6. gltf.scene.position.set(120, 30, 195);
  7. gltf.scene.rotation.y += 1.6;
  8.  
  9.  
  10. const animation=gltf.animations[0];
  11. const mixer = new THREE.AnimationMixer(gltf.scene);
  12. mixers.push(mixer);
  13.  
  14. const action = mixer.clipAction(animation);
  15. action.play();
  16. scene.add(gltf.scene);
  17.  
  18. var clonee= gltf.scene.clone();
  19. clonee.position.set(120,30,250);
  20. const mixer2 = new THREE.AnimationMixer(clonee);
  21. mixers.push(mixer2);
  22.  
  23. const action2 = mixer2.clipAction(animation);
  24. action2.play();
  25. scene.add(clonee);
  26.  
  27.  
  28. animate();
  29. }, undefined, function(error) {
  30. console.error(error);
  31. });
  32.  
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement