Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

380
Views
No se puede cargar el modelo usando GLTFLoader en Vue2

Uso GLTFLoader para cargar el modelo en mi aplicación Vue2. Uso la plantilla común Three.js. GLTFLoader se toma directamente de los documentos de Three.js. Mi ejemplo es muy fácil, pero incluso en este caso no puedo cargar el modelo. No tengo idea de qué puede estar mal con mi código, no puedo ver ningún error:

 <template> <div id="viewport" ref="container"></div> </template> <script> import * as THREE from 'three' import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js' export default { name: 'Scene', data() { return { camera: null, scene: null, renderer: null, mesh: null } }, methods: { init() { this.camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 10); this.camera.position.z = 1; this.scene = new THREE.Scene(); this.renderer = new THREE.WebGLRenderer({antialias: true}); this.renderer.setSize(window.innerWidth, window.innerHeight); this.$refs.container.appendChild(this.renderer.domElement); const loader = new GLTFLoader(); loader.load("Avocado.glb", (glb) => { console.log(glb) this.scene.add(glb.scene); }, function (xhr) { console.log((xhr.loaded / xhr.total) * 100 + "% loaded"); }, function (error) { console.log("An error happened"); } ); }, animate() { requestAnimationFrame(this.animate); this.renderer.render(this.scene, this.camera); } }, mounted() { this.init(); this.animate(); } } </script>

Aquí hay un ejemplo reproducible: https://codesandbox.io/s/vue-2-playground-forked-q6lchp?file=/src/components/Model.vue

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

así que arreglé los problemas actuales y posteriores en codesandbox. Consulte aquí: https://codesandbox.io/s/vue-2-playground-forked-tlpdi9 .

Los problemas resueltos:

  1. No tiene el componente Home en ninguna parte de su componente App .
  2. Deberías usar three y no three-js

Hay más en los códigos y el cuadro vinculados anteriormente, como aumentar el valor lejano de su cámara y agregar iluminación para que pueda ver el aguacate.

avance

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!