Replies: 3 comments 1 reply
-
this is just about the path, i dont think that http://localhost:3000/spinner.glb is correct. the model has to be inside the public folder and the path is most likely just /spinner.glb. useGLTF is correct. you could useLoader(GLTFLoader, url) but GLTF is more complex than that, useGLTF takes care of setting up some extensions like draco and meshopt. as for suspense, i think you'd need to ask next, suspense is a standard react fature since 16.4, if they dont support that it would be kind of weird. |
Beta Was this translation helpful? Give feedback.
-
@drcmda the path should be right fine. nextjs want absolute paths - if i change it either nextjs complains or I get a 404. the suspense thing is fixed so it has to be something different |
Beta Was this translation helpful? Give feedback.
-
This shouldn't be executed on the server-side. I'd retry import dynamic from 'next/dynamic'
const Spinner = dynamic(
() => import('./Spinner'),
{ ssr: false }
) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How to load a model GLTF model in next.js?
I spend hours looking for this. Nothing works :(
What I tried so far:
useLoader(GLTFLoader,url) / useGLTF(url) and some more
next/dynamic
component / dont do itsuspense
not beeing support by installing next with react 18three-stdlib
next.config.js
read every issue and forum post i could find on tis issue
The error i get at the moment is:
with a component looking like this:
package.json:
node-version:
Beta Was this translation helpful? Give feedback.
All reactions