Hi there,
After looking around to find people with similar issues I could not find a fix for the following problem:
I have a fully functional threejs setup with 3 objects and some textures, however when I now try to add a new THREE.LoadingManager(); and add an onStart/onLoad/onProgress function to it, it never actually triggers.
Basic code here:
scene = new THREE.Scene();
scene.background = new THREE.Color(0x0e0e0e);
scene.fog = new THREE.Fog(0x0e0e0e, 200, 600);
camera = new THREE.PerspectiveCamera(65, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(0, 0, 20);
renderer = new THREE.WebGLRenderer({
antialias: true
});
renderer.setSize(window.innerWidth, window.innerHeight);
manager = new THREE.LoadingManager();
manager.onStart = (url, itemsLoaded, itemsTotal) => {
console.log(`Started loading file: ${url}.\nLoaded ${itemsLoaded} of ${itemsTotal} files.`);
};
manager.onLoad = () => {
console.log('Loading complete!');
};
manager.onProgress = (url, itemsLoaded, itemsTotal) => {
console.log(`Loading file: ${url}.\nLoaded ${itemsLoaded} of ${itemsTotal} files.`);
};
this.landingContainer.appendChild(renderer.domElement);
I can actually log the manager and it does say the functions are being ‘filled in’.
Currently my order of doing this is as follows: init scene - init camera - init loader - init lights - init objects - init events - init loop.