Can I download a 3d model to my in production project hosted on vercel?
Answered
House Wren posted this in #help-forum
House WrenOP
I'm trying to build a 3d project and I'm wondering how to approach this feature I want my client to be able to edit the model on the website from his dasboard I'm using R3F where can display a model as gltf
Answered by B33fb0n3
you can directly use the path to the file inside your loader. Like this:
const {scene, animations} = useLoader(GLTFLoader, url) // to have Cache20 Replies
@House Wren I'm trying to build a 3d project and I'm wondering how to approach this feature I want my client to be able to edit the model on the website from his dasboard I'm using R3F where can display a model as gltf
yes you can. For gltf you need to load the .scene and this file loads all additional stuff. If you want everything in one file, you can use the file format .glb
@House Wrensolved?
@B33fb0n3 <@829430877330079794>solved?
House WrenOP
no
how do I fetch this .glb online
or can I dowonload it to the project files?
@House Wren how do I fetch this .glb online
you can directly use the path to the file inside your loader. Like this:
const {scene, animations} = useLoader(GLTFLoader, url) // to have CacheAnswer
House WrenOP
yes but what if I don't have that .glb file and I want to download it on demand, the client want to be able to change the model from his admin dashboard
@House Wren yes but what if I don't have that .glb file and I want to download it on demand, the client want to be able to change the model from his admin dashboard
yea, as you can see, the
url is a variable. It's not static like bla/bla/bla.glb. Because it's a variable, you can change this variable. So choose your way how you want to change this variable and you are good to go 🙂House WrenOP
wow if that works it will be cool
can I fetch something from sketchfab or I've to download it and host on something like google drive
@House Wren can I fetch something from sketchfab or I've to download it and host on something like google drive
you can use their download api: https://sketchfab.com/developers/download-api
But you can also host the files on your system. That you want to think about how the user can upload stuff, where the files are then and how they will be downloaded
But you can also host the files on your system. That you want to think about how the user can upload stuff, where the files are then and how they will be downloaded
House WrenOP
Hmmm google drive doesn't work?
const { nodes, materials, animations, scene } = useGLTF(
"https://drive.google.com/file/d/1KxbqnnkrFfPKrfciOMlgQVXVu2bX7CuP/view?usp=drive_link"
);
"https://drive.google.com/file/d/1KxbqnnkrFfPKrfciOMlgQVXVu2bX7CuP/view?usp=drive_link"
);
@House Wren Hmmm google drive doesn't work?
Maybe google drive does not allow the connection from you. Try to link directly to the .glb file and don’t use google drive
House WrenOP
I'm trying the sketchfab api and I'll let u know
should I close this question ?
If you know what your next steps are so this thread is solved, then yes, mark this message as answer (I guess ut the most fitting messages): https://nextjs-forum.com/post/1256893576521191474#message-1257731470097780766
House WrenOP
I guess the sketchfab API might work not sure tho I'll mark it as solved I can reopen the questio yeah ?
@House Wren I guess the sketchfab API might work not sure tho I'll mark it as solved I can reopen the questio yeah ?
Yea, this thread is specifically to loading a gltf. When you have issues with sketchfab api, just open a new thread and share some details, where you have issues