Created
March 15, 2012 14:23
-
-
Save Ricket/2044441 to your computer and use it in GitHub Desktop.
Three.js mouse picking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var projector = new THREE.Projector(); | |
var ray = projector.pickingRay( mouseCoord, camera ); // (mouse coord are in screenspace and must be [-1, 1]) | |
var objects = ray.intersectObjects( scene.children ); | |
if( objects.length ) | |
{ | |
objects[ 0 ].object; // THREE.Particule or THREE.Mesh | |
objects[ 0 ].face; // THREE.Face3 or THREE.Face4 (is .object is a Mesh | |
objects[ 0 ].point; // THREE.Vector3 | |
} | |
// found at: https://github.com/mrdoob/three.js/issues/1517#issuecomment-4520401 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment