2

I am new at threejs so please have patience thank you.

I have loaded this gltf file into my entire code which renders a 3D earth. I am trying to load this 3D model of a spacecraft onto that same page.

Aqua13();
function Aqua13 () {
  new GLTFLoader()
    .setPath("js/three/examples/models/gltf/")
    .load("Aqua_13.glb", function (gltf) {

        gltf.scene.position.set(500, 500, 600);
        scene.add(gltf.scene);
      // gltf.scene.traverse( function ( child ) {
      //   if ( child.isMesh ) 
      //     roughnessMipmapper.generateMipmaps( child.material );
      //   }

      //   roughnessMipmapper.dispose();
      // } 
      // );
      // console.log('GLTF:', gltf);

      // const object = gltf.scene.getObjectByName("SheenChair_fabric");
      // const gui = new GUI();
      // console.log('object:', object);
      // gui.add(object.material, "sheen", 0, 1);
      
      // gui.open();
    });
}

And here is the render function:


// Main render function
let render = function () {
  earth.getObjectByName("surface").rotation.y += (1 / 32) * 0.01;
  earth.getObjectByName("atmosphere").rotation.y += (1 / 16) * 0.01;
  if (cameraAutoRotation) {
    cameraRotation += cameraRotationSpeed;
    camera.position.y = 0;
    camera.position.x = 2 * Math.sin(cameraRotation);
    camera.position.z = 2 * Math.cos(cameraRotation);
    camera.lookAt(earth.position);
  }
  requestAnimationFrame(render);
  renderer.render(scene, camera);
};

render();

Please let me know if there's anything I forgot to add. Thank you so much.

0 Answers0