title: javascript THREE OrbitControls: doubleclick Object
body: <p>I am using THREE.js and OrbitControls.js. I want to doubleclick an Object and then do stuff.
  This is the code I am using. cube1 is the Object I want to doubleclick.</p>
  
  <pre><code>var projector = new THREE.Projector();
  
  document.addEventListener('dblclick', ondblclick, false);
  
  function ondblclick(event)
  {               
      var vector = new THREE.Vector3(
      ( event.clientX / window.innerWidth ) * 2 - 1,
      - ( event.clientY / window.innerHeight ) * 2 + 1,
      0.5);
      projector.unprojectVector( vector, camera );
  
      var ray = new THREE.Ray( camera.position, 
                       vector.subSelf( camera.position ).normalize() );
  
      var intersects = ray.intersectObjects( cube1 );
  
      if ( intersects.length &gt; 0 )
      {
          alert("hit");
      }
  }
  </code></pre>
  
  <p>Unfortunately the code does not work.
  I appreciate any help.
  This is the camera I am using:</p>
  
  <pre><code>var camera = new THREE.PerspectiveCamera( 45, WIDTH/HEIGHT, 0.1, 10000 );
          camera.position.z = 1500;
          camera.position.y = -1800;
          scene.add(camera);
  </code></pre>
  
  <p>And this is OrbitControls:</p>
  
  <pre><code>var controls = new THREE.OrbitControls(camera, renderer.domElement);
  </code></pre>