This code loads a standalone gltf file, but I have a file that contains multiple bin and texture files
import React from "react";
import { useLoader } from "react-three-fiber";
let GLTFLoader;
/**
* @name Scene
* @param {*} url received
* @returns {html} primitive
*/
function Scene({ url }) {
GLTFLoader = require('three/examples/jsm/loaders/GLTFLoader').GLTFLoader;
const gltf = useLoader(GLTFLoader, url);
const { nodes } = gltf;
return (
<group>
<mesh visible >
<bufferGeometry attach="geometry" {...nodes.mesh_0_18.geometry} />
<meshStandardMaterial
attach="material"
color="white"
roughness={0.3}
metalness={0.3}
/>
</mesh>
</group>
);
}
export default Scene;
Iām displaying this file here:
<Canvas style={{height:"400px",width:"100%", background: "#ccc"}}>
<directionalLight intensity={0.5} />
<Suspense fallback={ <Loading /> }>
<Scene url="/static/avatars/polka-dot-slip-dress/polka-dot-slip-dress_Colorway-1.gltf"/>
</Suspense>
</Canvas>
I believe the problem with this code is
<bufferGeometry attach="geometry" {...nodes.mesh_0_18.geometry} /> , there are 20 mesh files. How do I get this to load as I think it might be a geometry issue?