Qu4sar
Qu4sar

Reputation: 64

Is it possible to load a Three.js Editor exported scene with React Three Fiber (r3f)

I was wondering some issue during r3f implementation of a scene made with Three.js Editor.

There is any issue about loading of json from an exported file ?

function Scene() {
    const gltf = useLoader (GLTFLoader, '/app.json')    
    return (
    <Suspense fallback={null}> 
      <primitive object={gltf} />
    </Suspense>
    )
  } 

Upvotes: 0

Views: 659

Answers (2)

Tommy Rivera
Tommy Rivera

Reputation: 75

I believe GLTFLoader works with GLTF file types.

You can use three fiber drei functions with a "glb" export to load the model with out the colors then use the json file to reference and hard code all the colors and styles manually but it might be too tedious.

Unless you figured out a way to use the json file with GLTFLoader?

Upvotes: 0

Dennis Smolek
Dennis Smolek

Reputation: 8770

I’m not sure what the editor may or may not be doing, but if you use the GLTFloader in vanilla than it should via react.

One thing to note is you’re telling r3f to use the GLTF importer and while it is possible to export GLTF from the editor, being saved as json is less common…

Upvotes: 0

Related Questions