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

544
Views
How to load an object file in three.js?

I'm trying to load a .obj file in three.js but I'm having trouble importing the libraries for the object loader. In the console it says THREE.OBJLoader2 is not a constructor. I'm trying to load the file locally.

I also tried loading the .gltf file using the gltfloader library, but I can't seem to import the libraries correctly.

this is the html code to import the OBJLoader script:

<script src="resources/threejs/r105/js/loaders/LoaderSupport.js"></script>
<script src="resources/threejs/r105/js/loaders/OBJLoader2.js"></script>

this is the js code for obj loader:

    const objLoader = new THREE.OBJLoader2();
    objLoader.load('house.obj', (event) => {
    const root = event.detail.loaderRootNode;
    scene.add(root);
});

I also tried to import the libraries locally by creating a GLTFLoader.js file and using

  <script src="GLTFLoader.js"></script> 

but that did not work either.

about 4 years ago · Juan Pablo Isaza
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!