I get the following error message when reloading the page with the canvas on it.
" R3F: Primitives without ‘object’ are invalid!"
function DroneModel() {
const file_loaded = useGLTF('/model.gltf');
const model = file_loaded.scene.children[0]
return (
<primitive
object={model}
dispose={null}
/>
);
}
To me it seems that the loader does not load the full model on the second render.
At the first render file_loaded.scene.children[0] chain is loaded all the way. However, on the second render it only seems to load “file_loaded.scene” and children is none.
function DroneModel() {
const file_loaded = useGLTF('/model.gltf');
const model = file_loaded.scene.children[0]
return (
<primitive
object={model}
dispose={null}
/>
);
}
useGLTF.preload('/model.gltf')
also scene.children[0] is unpredictable as it can return a different child each time the model is loaded… it’s much more stable to get children by name using…