jlengstorf / gatsby-react-three-fiber-demo

MIT License
29 stars 12 forks source link

I was following this using React and I get Unexpected token error everytime I load the model. #9

Closed Varuas37 closed 3 years ago

Varuas37 commented 3 years ago

I have my 3d model inside src/assets/3DAssets and I am importing it to one of my component located in src/Components/Page/Mode/ModelComponent.js

index.js:1 SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse () at GLTFLoader.parse (GLTFLoader.js:281) at Object.onLoad (GLTFLoader.js:174) at XMLHttpRequest. (three.module.js:36662)

Has anyone had that issue? I am also using a different model from the original tutorial. Its a gltf file too, but I don't know why i am having this issue.

jlengstorf commented 3 years ago

I'm not sure (definitely not an expert on this) but that error looks like either the file is in the wrong format or you're getting a loading error (like a 404) that's not properly encoded

if you can, try logging the contents of the model you're loading to see if it's actually bringing in a 3D model or if you're getting something else

if that doesn't work, you may want to try the GLTFLoader repo? I don't know if anyone other than me looks at this one, and I definitely don't know how to fix 3D models :joy:

I'm going to close this since help will need to come from somewhere else. good luck!