title: Extending Three.js classes
body: <p>I want to extend the Three.js Object3D class, but can't figure out how to do it.</p>
  
  <p>There's this Stackoverflow question, which I've read, re-read and tried, but can't get it to work for me.</p>
  
  <p><a href="https://stackoverflow.com/questions/10999155/is-there-a-way-to-extend-a-threejs-object">Is there a way to extend a ThreeJS object?</a></p>
  
  <p>Could anyone offer some specific code on how to get this going?  Here's what I have at the moment:</p>
  
  <pre><code>var MyObject3D = function() {
     THREE.Object3D.call(this);
     MyObject3D.prototype = new THREE.CubeGeometry();
     MyObject3D.prototype.constructor = MyObject3D;
  }
  </code></pre>
  
  <p>And to create an instance:</p>
  
  <pre><code>var thing = new MyObject3D();
  var testGeo = new THREE.CubeGeometry(10, 10, 10);
  var testMat = new THREE.MeshPhongMaterial();
  var testMesh = new THREE.Mesh(testGeo, testMat);
  thing.add(testMesh);
  </code></pre>
  
  <p>But calling the "add" method of the MyObject3D instance returns an error that "thing" has no method "add."</p>
  
  <p>What's the deal?</p>