# Object doesn't load

**URL:** <https://discourse.threejs.org/t/object-doesnt-load/3969>\
**Category:** Questions\
**Tags:** loaders\
**Created:** [August 31, 2018, 2:04am UTC](https://discourse.threejs.org/t/object-doesnt-load/3969 "2018-08-31T02:04:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ALA96](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@ALA96](https://discourse.threejs.org/u/ALA96)\
**Post date:** [August 31, 2018, 2:04am UTC](https://discourse.threejs.org/t/object-doesnt-load/3969/1 "2018-08-31T02:04:31Z")

</div>

Hi, i;m using json model with objectloader to load model in three.js. but it’s always getting error like this. I’m trying to fix with [this](https://stackoverflow.com/questions/32039553/three-js-typeerror-cannot-read-property-center-of-undefined). But still error. What should i do?

`Uncaught TypeError: Cannot read property ‘center’ of undefined  
at Ea.copy (three.min.js:381)  
at ld.intersectsObject (three.min.js:389)  
at m (three.min.js:150)  
at m (three.min.js:150)  
at Xd.render (three.min.js:185)  
at timer (3d.js:499)

here’s my code

```auto
var loader = new THREE.ObjectLoader();
  loader.load( 'assets/tigad/rocket1.json', addModelToScene );
  
 // Load the Blender object to the scene
  function addModelToScene( geometry, materials ) {
    var model = new THREE.MeshBasicMaterial(materials);
    model = new THREE.Mesh( geometry, materials );
    model.scale.set(20,20.5,50);
    scene.add( model );

    animate(model);
  }

function animate(model) {

  // requestAnimationFrame( animate );
  // console.log(objnya)

  for (let i=0; i < objnyaArray.length; i++){
    console.log(objnyaArray[i]);

    setTimeout( function timer(){
      
   
       document.getElementById("roll").innerHTML = objnyaArray[i].x;
       document.getElementById("pitch").innerHTML = objnyaArray[i].y;
       document.getElementById("yaw").innerHTML = objnyaArray[i].z;

       model.rotation.z = 1 * objnyaArray[i].x * 0.0174533;
       model.rotation.x = objnyaArray[i].y * 0.0174533;
       model.rotation.y = -1 * objnyaArray[i].z * 0.0174533;

        renderer.render( scene, camera );

        console.log('data putaran ke', i , objnyaArray[i] )
   }, i*1000 );

  }

```

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [August 31, 2018, 2:41am UTC](https://discourse.threejs.org/t/object-doesnt-load/3969/2 "2018-08-31T02:41:36Z")

</div>

it looks like you have your render function in a `setTimeout` in a render loop, and it isn’t waiting for the model to load before modifying `model`, you’ll want to look at the examples in the threejs repo like this: [https://github.com/mrdoob/three.js/blob/master/examples/webgl\_loader\_json\_claraio.html#L115-L132](https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_json_claraio.html#L115-L132)

---

<div class="post-metadata">

**Author:** ![ALA96](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@ALA96](https://discourse.threejs.org/u/ALA96)\
**Post date:** [August 31, 2018, 4:25am UTC](https://discourse.threejs.org/t/object-doesnt-load/3969/3 "2018-08-31T04:25:17Z")

</div>

thanks for your reference
