Good day,
I have been trying to set up my 3D object for my portfolio page and I want for people to be able to interact with it. The problem is, I managed to render the object with an animation and could see it, but when I started adding the code for the ArcballControls in order to allow for users to drag and see my object from all sides, the object just disappears and the only thing I see is a black screen !
<script src="js/three.js"></script> <!--Problem of no rendering anything (sourcing of the script had an error)-->
<script type="module" src="GLTFLoader.js"></script>
<script type="module" src="ArcballControls.js"></script>
<script type="module"> //in order for GLTFLoader to work we need a module tag
import {GLTFLoader} from "./GLTFLoader.js";
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
var controls = new ArcballControls( camera, renderer.domElement, scene );
controls.addEventListener( 'change', function () {
renderer.render( scene, camera );
} );
camera.position.set( 0, 20, 100 );
controls.update();
Thank you for your time.