title: normalizing mesh in three.js
body: <p>I'm loading a mesh from an obj file, then trying to normalize it. However, I'm getting strange results. Here is the code for loading and centering the mesh:</p>
  
  <pre><code>var manager = new THREE.LoadingManager();
  var loader = new THREE.OBJLoader(manager);
  loader.load('http://jamesdedge.com/threejs/bunny.obj', function(object) {
    object.traverse(function(child) {
      if(child instanceof THREE.Mesh)
      {
        var geometry = child.geometry;
        var verts = geometry.vertices;
        var ctr = new THREE.Vector3(0.0, 0.0, 0.0);
  
  
        for(i = 0; i &lt; verts.length; ++i)
          ctr.add(verts[i]);
  
        ctr.divideScalar(verts.length);
  
        for(i = 0; i &lt; verts.length; ++i)
          verts[i].sub(ctr);
      }
    });
  
    scene.add(object);
  });
  </code></pre>
  
  <p>This code should just center the mesh on the average of the vertex positions, but it seems to be causing a strange effect. You can see it on my website here: <a href="http://jamesdedge.com/threejs/tjs_demo.html" rel="nofollow">http://jamesdedge.com/threejs/tjs_demo.html</a></p>
  
  <p>I don't see what is causing this, the ctr variable is giving me a valid vector and subtracting a vector from all the vertices will only reposition it. </p>