title: Creating a new object in three.js
body: <p>I'm currently working on a project that involves making 3Dobjects in Threejs, based of databases. </p>
  
  <p>I already have the connection etc, but it keeps failing when I try to create a new object.</p>
  
  <pre><code>    this.type = 'CustomObject';
      let shape = new THREE.Shape();
      const maxSize = coords.reduce((prev, current) =&gt; (Math.abs(prev.value) &gt; Math.abs(current.value)) ? prev : current); // max Size but Abs
      // console.log("Max size before check : "+ maxSize.value);
      //Check weither maxSize is positive or negative.
      let height = Math.abs(maxSize.value);
  
      shape.moveTo(0, 0);
      for (let i = 0; i &lt; coords.length; i++) {
          // console.log(coords[i]);
          shape.lineTo(coords[i].id, coords[i].value);
      }
  
      shape.lineTo(coords[coords.length - 1].id, -height - 3);
      shape.lineTo(0, -height - 3);
      shape.lineTo(0, 0);
      // let geometry = new THREE.ExtrudeGeometry( shape, extrudeSettings );
      let extrudeSettings = {
          steps: 4,
          amount: 20,
          bevelEnabled: false,
          bevelThickness: 1,
          bevelSize: 1,
          bevelSegments: 1
      };
      this.geometry = new THREE.ExtrudeGeometry(shape, extrudeSettings);
      this.material = new THREE.MeshBasicMaterial({color: 0xCbcbcb});
      let object = new THREE.Mesh( this.geometry, this.material );
      this.createdGraph = object;
      console.log(this.createdGraph.Object3D);
      this.scene.add(this.createdGraph);
  }
  </code></pre>
  
  <p>This is just part of the code, I know it's not the best. But I would like to work it before I clean it.
  It's writen with ES6 in mind.</p>
  
  <p>The problem is that if you execute the code, it does create the figure I'd like to have.</p>
  
  <p>A screengrab of the object created by the code.<br/><a href="https://i.stack.imgur.com/wXkfg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wXkfg.png" alt="A screengrab of the object created by the code."></a></p>
  
  <p>But if I try to add it to A-Frame ( because I've worked with it before), it keeps giving me the error that I can't add an object without an Object3D to the scene or 'this.updateMorphTargets is not a function ' .</p>
  
  <p>Anyone have any ideas ?</p>
  
  <p>PS I've also tried this <a href="https://stackoverflow.com/a/31924233">https://stackoverflow.com/a/31924233</a> idea, but that comes back with the ' this.updateMorphTargets is not a function' error.</p>
  
  <p>Thanks :)</p>