0
votes

I'm trying to load a simple car model that is separated into tires, body and windows into three.js, I use Blender to export as .json but when I use the JSONloader it only loads the body.

So then I try to export it as scene, but when I use the JSONloader nothing show up in the scene.

So I have two questions:

  1. What is the proper way to export and load a multi part model from Blender JSON?
  2. How do I load a JSON scene exported from Blender into three.js?

Following @larsenhupin suggestion heres my try with objectloader, however the scene doesn't show

//LOAD A JSON SCENE

var loader = new THREE.ObjectLoader();

loader.load(
    // resource URL
    "models/stockcarb.json"

    // pass the loaded data to the onLoad function.
//Here it is assumed to be an object
    function ( obj ) {
        //add the loaded object to the scene
        scene.add( obj );
    },

    // Function called when download progresses
    function ( xhr ) {
        console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
    },

    // Function called when download errors
    function ( xhr ) {
        console.error( 'An error happened' );
    }
);
1

1 Answers

0
votes

In my experience, when I export a scene from Blender it works using the ObjectLoader(); instead of the JSONLoader();.

https://threejs.org/docs/api/loaders/ObjectLoader.html

Do you plan to use animations ? I ask because I've never been able to use animations with the ObjectLoader, it can works but it never happened for me.