[Vuejs]-How to load a GLTF 3D object from a public cloud server in a Vue.js application?

0👍

You can achieve what you wish to do with the three.js library. You have to define a path during the initialization of the GLTFLoader class and then indicate the file you want to display.

Code:

const loader = new GLTFLoader().setPath( 'https://files.catbox.moe/' );
loader.load(
  'sgdtnt.gltf',
  function (gltf) {
    scene.add(gltf.scene)
  },
  (xhr) => {
    console.log((xhr.loaded / xhr.total) * 100 + '% loaded')
  },
  (error) => {
    console.log(error)
  }
)

Working example on CodePen: https://codepen.io/tymoteuszlao/pen/YzJWwBO

Leave a comment