How to add a 3D model to the site?

40 Views Asked by At

I am making the second version of my site using the THREE library, react-three/fiber and react-three/drei. When I made the first version of the site, half a year ago, 3D models were added and there were no problems. Now I do the same actions, but when adding a 3D model, I always get the error "Uncaught TypeError: Cannot read properties of undefined (reading 'length')". I have already tried to add 3d files in different formats (glb, gltf...). I use the "npx gltfjsx [Model.glb]" command to transform the code into jsx and it doesn't help( the versions of the libraries are the same as they were on the first site. Please help to solve the problem

I re-created the project, already using Vite React. and this time I saw that the 3D model was added, but only in parts, and the problem "Uncaught TypeError: Cannot read properties of undefined (reading 'length')" did not disappear. there were no problems in the first version of the site

1

There are 1 best solutions below

1
On

Check the model again this kind error occurs when your model is not correctly exported try exporting your model again or check the model in blender and remove unwanted elements like meshes shapes, etc