so i’m trying to make a simple game with three.js My first step here is loading a GLTF file, but gives me this error: Uncaught SyntaxError: Unexpected token ‘:’ (at abarth131.gltf?import:2:9)
What i tried?
check the path
change the GLTF to public
in GLTF viewer the model loads normally
I dont know
here is my code:
let scene, camera, renderer, light
function init(){
scene = new three.Scene()
scene.background = new three.Color(0xdddddd)
camera = new three.PerspectiveCamera(40, window.innerWidth/window.innerHeight,1 ,5000)
light = new three.AmbientLight(0x404040, 100)
scene.add(light)
renderer = new three.WebGLRenderer({antialias:true})
renderer.setSize(window.innerWidth, window.innerHeight)
document.body.appendChild(renderer.domElement)
let loader = new GLTFLoader()
loader.load('../public/abarth131/abarth131.gltf', (gltf) => {
scene.add(gltf.scene)
renderer.render(scene,camera)
})
}
init()
Im developing with Vite, in vanilla JS (sorry if my english is weird, i speak spanish)
Any help will be received!
EDIT: the error showed on chrome dev tools