Solution 1 :

You’re following an outdated tutorial, but the explanation on how to fix it is right there in yellow letters. OrbitControls now requires a second parameter with the HTML element that you want to listen to mouse events. For example, you could use the canvas that the Renderer generates:

THREE.OrbitControls(camera, renderer.domElement);

Problem :

I have been following this guide to get three.js to work: https://www.youtube.com/watch?v=1TeMXIWRrqE

I pasted his source code from the bottom of this website: https://redstapler.co/add-3d-model-to-website-threejs/

Downloaded the model and extracted it to the directory html

Got the gtflloader and orbitcotrols from the links in the discription. I have created files with those names in the html directory and pasted the code in.

And I got the three.min.js from the official three.js download folder and I have put it the html directory.

I am getting this error. Is it me doing something wrong? Or the code is broken? If so what would be the fix?

enter image description here

Comments

Comment posted by here

Some more up to date tutorials

Comment posted by Jonas Blazinskas

had to move this up to the front as well: renderer = new THREE.WebGLRenderer({ antialias: true });

By

Leave a Reply

Your email address will not be published. Required fields are marked *