title: Change color of mesh using mouseover in three js
body: <p>I've put together a WebGL script that displays several meshes using jsonloader and three.js and I now want to add MouseOver and onClick events. The first of these is simply changing the colour of the mesh when the mouse hovers over it:</p>
  
  <pre><code>function render() {
    requestAnimationFrame(render);    
    mesh.rotation.z += 0.090;    
    raycaster.setFromCamera(mouse, camera);    
    var intersects = raycaster.intersectObjects(scene.children);  
  
    for (var i = 0; i &lt; intersects.length; i++) {    
      intersects[i].object.material.color.set(0xff0000);    
    }    
    renderer.render(scene, camera);
  
  }
  </code></pre>
  
  <p>The render function above allows me to change the colour of any mesh to red by hovering over it. I've tried several if/else variants to try and have this effect only work when the mouse is over a mesh but I can't get it to  work- it just stays red. Can anyone suggest how I might amend my script?</p>
  
  <p>Thanks.</p>