как оживить модель GLTF, используя три. js - PullRequest
1 голос
/ 10 января 2020

Я пытаюсь оживить мою 3d модель, которая является моделью gltf. Я пытаюсь и получаю, но не уверен, что могло быть не так в коде.

  // Load a glTF resource
  loader.load(
    // resource URL
    "human-small-with-uniform-and-lighting-all.gltf",
    // called when the resource is loaded
    function(gltf) {
      console.log(gltf.animations[0]);
      mixer = new THREE.AnimationMixer(gltf.scene);
      action = mixer.clipAction(gltf.animations[0]);
      action.play();
      scene.add(gltf.scene);
    },
    function(xhr) {
      console.log((xhr.loaded / xhr.total) * 100 + "% loaded");
    },
    function(error) {
      console.log("An error happened");
    }
  );

Это json структура gltf.animations, правая сторона изображения

enter image description here

...