title: Three.js / Intersection
body: <p>In my three.js scene, I have some cubes. I would like to offer possibility to the user to select a box with his mouse.</p>
  
  <p>This the significant code (I use Three.js version 69.) :</p>
  
  <pre><code>function init() {
      [...]
      camera = new THREE.PerspectiveCamera(VIEW_ANGLE,ASPECT,NEAR,FAR);
      [...]
      // in a 'for' iteration, I a many boxes in a 'objects' array :
          abox = new THREE.Mesh( geometry, material );
          objects.push( abox );
      [...]
      vector = new THREE.Vector3(0,0,0);
      raycaster = new THREE.Raycaster();
      animate();  
      document.addEventListener( 'mousedown', onDocumentMouseDown, false     );  
  }
  
  
  function onDocumentMouseDown( event ) {
      event.preventDefault();
      if ( camera instanceof THREE.OrthographicCamera ) {
          vector.set( ( event.clientX / window.innerWidth ) * 2 - 1, - ( event.clientY / window.innerHeight ) * 2 + 1, - 1 );
          vector.unproject( camera );
          dir.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );
          raycaster.set( vector, dir );
      } else if ( camera instanceof THREE.PerspectiveCamera ) {
          vector.set( ( event.clientX / window.innerWidth ) * 2 - 1, - ( event.clientY / window.innerHeight ) * 2 + 1, 0.5 );
          vector.unproject( camera );
          raycaster.set( camera.position, vector.sub( camera.position ).normalize() );
      }
  
      var intersects = raycaster.intersectObjects( objects , false);
  
      if ( intersects.length &gt; 0 ) {
  
          var intersect = intersects[ 0 ];
  
          // change color of the face
          intersect.object.material.color.setHex( Math.random() * 0xFF0000 );
  
          renderer.render(scene, camera);
  
          }
  
      }
  </code></pre>
  
  <p>When I click on a cube, the point (intersect) selected is not exactly (near, but not exactly) where I clicked. There is like a shift, a translation (I tried with an Orthographic or Perpective camera....same problem).</p>
  
  <p>Any help is welcome.</p>
  
  <p>Thanks    </p>