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

302
Views
cargue un modelo 3D con GLTFLoader (ThreeJS) en Reactjs sin usar React Fiber

Quiero cargar un modelo 3D con GLTFLoader pero me da error de sintaxis

y probé estas formas

  • const cargador = nuevo TRES.GLTFLoader();
  • const cargador = nuevo GLTFLoader(); después de importarlo

pero todo lo anterior no funcionó conmigo

¿Cómo puedo resolver esto sin usar React Fiber?

ingrese la descripción de la imagen aquí

 import { useEffect } from "react"; import * as THREE from "three"; import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js"; import Stats from "three/examples/jsm/libs/stats.module"; import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader"; export default function Main() { useEffect(() => { /** * scene */ const scene = new THREE.Scene(); /** * textures */ const textureLoader = new THREE.TextureLoader(); const matcapTexture = textureLoader.load("./static/textures/matcaps/1.png"); /** * objects */ // torus const torusGeometry = new THREE.TorusBufferGeometry(0.2, 0.1, 15, 45); // const torusMaterial = new THREE.MeshMatcapMaterial({ map: matcapTexture }); const torusMaterial = new THREE.MeshNormalMaterial(); const torus = new THREE.Mesh(torusGeometry, torusMaterial); torus.position.set(0, 0.3, 0); scene.add(torus); // 3D model const loader = new GLTFLoader(); loader.load("./model_1/scene.gltf", (gltf) => { scene.add(gltf.scene); }); /** * camera */ const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.01, 10000 ); camera.position.set(0, 0, 4); scene.add(camera); /** * renderer */ const canvas = document.querySelector("#canvasElement"); const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, }); renderer.setSize(window.innerWidth, 400); renderer.setClearColor("white"); }, []); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Descubrí que debería haber puesto los archivos del modelo en la carpeta pública

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!