How to pass GLTF JSON into useGLTF() to get the scene ? #1344
Unanswered
wdcs-kushaltanna
asked this question in
Q&A
Replies: 1 comment
-
all loader hooks are abstractions around loader.load(url, cb), useGLTF is the same as you can use import { suspend } from 'suspend-react'
function useGLTFAB(...) {
return suspend(async () => {
// Load the array buffer here
}, [...]) imo there's no point in handling errors and loading states like you do, suspense was made for that in react and pretty much everything in fiber already uses it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am facing an issue with dynamically rendering 3D object's GLTF JSON using the useGLTF() hook in a React component. Specifically, the examples provided with the useGLTF() hook show how to load GLTF data from a file path, but I am working with GLTF data that is obtained via an API call.
I would greatly appreciate any suggestions or solutions for loading GLTF data obtained from an API call with the useGLTF() hook. Thank you in advance for your help.
Beta Was this translation helpful? Give feedback.
All reactions