I'm currently working on incorporating a 3D model into my webpage using Three.js and I've encountered a 404 Error while trying to fetch the model with GLTFLoader. It's puzzling because I am certain that the path to the model is correct. Here is the error message displayed in the console:
Error: fetch for "http://127.0.0.1:5500/modele/voiture/scene.gltf" responded with 404: Not Found
Within my JavaScript code, I have implemented a loadModel() function which I then included in my init() function. This is how the loadModel() function looks like:
function loadModel() {
// ------------ 3D Image Loader -------------- //
const loader = new THREE.GLTFLoader();
//loader.setCrossOrigin('./');
loader.load('modele/voiture/scene.gltf', function(gltf){
var voiture = gltf.scene;
voiture.scale.setScalar(5);
scene.add(gltf.scene);
voiture = gltf.scene.children[0];
rendu.render(scene, camera);
});
}
I would greatly appreciate any advice or feedback on my code. Thank you so much in advance!