Hy, i integrated my three js project into react and everything works well except for loading the objects.
I tried to load it from the same folder as the script, and still receive a 404 error.
While working static there were no problems with the loading.
Is there something that should be done when integrating three in react?
Would gladly scroll the internet , but have a strict deadline so any help is welcome , thanks
better use react-three-fiber for three in react. this is not a wrapper, but a custom renderer, so you’re writing plain threejs but in react semantics just like you write dom apps in react-dom (which is also a renderer).
especially in combination with gltfjsx because all that traversal code will go away. gltfjsx will create a jsx component graph for your gltf, similar to how you can render out svg’s. then you can directly change props, and this makes it also re-usable since you don’t destroy the source data.
if this is a configurator, here’s a nice and simple example for that: Shoe configurator - CodeSandbox
otherwise you’ll find tons of examples for model loading here: React Three Fiber Documentation
other than that, the path is wrong. top2x2.glb can’t be in your src folder, it has to be in /public.
Thanks for suggestion, i moved all my glb in public , and fixed the path, and in the end i could spawn my objects.