{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/8081","repository_url":"https://api.github.com/repos/mrdoob/three.js","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/8081/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/8081/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/8081/events","html_url":"https://github.com/mrdoob/three.js/issues/8081","id":131856030,"number":8081,"title":"Raycaster.intersectObjects() not returning anything?","user":{"login":"JohnnyDevNull","id":5759334,"avatar_url":"https://avatars.githubusercontent.com/u/5759334?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnnyDevNull","html_url":"https://github.com/JohnnyDevNull","followers_url":"https://api.github.com/users/JohnnyDevNull/followers","following_url":"https://api.github.com/users/JohnnyDevNull/following{/other_user}","gists_url":"https://api.github.com/users/JohnnyDevNull/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnnyDevNull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnnyDevNull/subscriptions","organizations_url":"https://api.github.com/users/JohnnyDevNull/orgs","repos_url":"https://api.github.com/users/JohnnyDevNull/repos","events_url":"https://api.github.com/users/JohnnyDevNull/events{/privacy}","received_events_url":"https://api.github.com/users/JohnnyDevNull/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-06T13:35:20Z","updated_at":"2016-02-06T14:18:38Z","closed_at":null,"body":"I have similar problems to this ones: \r\n\r\nhttp://stackoverflow.com/questions/31072742/raycaster-intersectobjects-not-returning-anything\r\nhttp://stackoverflow.com/questions/29688618/raycaster-intersectobjects-does-not-work-gives-the-empty-array-using-three-js\r\n\r\nso i took a watch at the examples and researche every line of code:\r\n\r\nhttp://threejs.org/examples/#webgl_interactive_cubes\r\nhttp://threejs.org/examples/#canvas_interactive_cubes\r\n\r\nbut nothing will work. Here comes my code:\r\n\r\n\r\n```\r\n    //controls = new THREE.OrbitControls( camera, renderer.domElement );\r\n\r\n\traycaster = new THREE.Raycaster();\r\n\r\n\tmouse = new THREE.Vector2();\r\n\tclickMaterial = new THREE.SpriteMaterial({\r\n\t\tcolor: 'red',\r\n\t\tsize: 5\r\n\t});\r\n\r\n[...]\r\n\r\n\tfor(var i = 0; i < system.length; i++) {\r\n\r\n\t\tvar object = system[i];\r\n\r\n\t\tif(object.type == 'star') {\r\n\r\n\t\t\tscene.add( SPACELIB.createStar( object ) );\r\n\r\n\t\t} else if (object.type == 'planet') {\r\n\r\n\t\t\tscene.add( SPACELIB.createPlanet( object ) );\r\n\r\n\t\t\tif(SPACELIB.pathHelper) {\r\n\r\n\t\t\t\tscene.add( SPACELIB.createPathHelper({\r\n\t\t\t\t\tradius: object.orbit.radius,\r\n\t\t\t\t\tvisible: {from: 50, to: 10000}\r\n\t\t\t\t}));\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n[...]\r\n\r\nfunction onDocumentMouseMove( event ) {\r\n\r\n\tevent.preventDefault();\r\n\r\n\tmouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;\r\n\tmouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;\r\n\r\n}\r\n\r\nfunction onMouseDown( event ) {\r\n\r\n\tevent.preventDefault();\r\n\r\n\traycaster.setFromCamera( mouse, camera );\r\n\r\n\tvar intersects = raycaster.intersectObjects( scene.children );\r\n\r\nconsole.log(intersects); // < --------------- is every Time a empty []\r\n\r\n\tif ( intersects.length > 0 ) {\r\n\r\n\t\tintersects[ 0 ].object.material.color.setHex( Math.random() * 0xffffff );\r\n\r\n\t\tvar particle = new THREE.Sprite( clickMaterial );\r\n\t\tparticle.position.copy( intersects[ 0 ].point );\r\n\t\tparticle.scale.x = particle.scale.y = 16;\r\n\t\tscene.add( particle );\r\n\r\n\t}\r\n}\r\n\r\n```\r\n\r\nI can't find the problem. Do i something wrong? Also the onMouseOver effect from the example doesn't work.\r\n\r\nPlease Help me.\r\n"},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/180772047","html_url":"https://github.com/mrdoob/three.js/issues/8081#issuecomment-180772047","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/8081","id":180772047,"user":{"login":"JohnnyDevNull","id":5759334,"avatar_url":"https://avatars.githubusercontent.com/u/5759334?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnnyDevNull","html_url":"https://github.com/JohnnyDevNull","followers_url":"https://api.github.com/users/JohnnyDevNull/followers","following_url":"https://api.github.com/users/JohnnyDevNull/following{/other_user}","gists_url":"https://api.github.com/users/JohnnyDevNull/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnnyDevNull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnnyDevNull/subscriptions","organizations_url":"https://api.github.com/users/JohnnyDevNull/orgs","repos_url":"https://api.github.com/users/JohnnyDevNull/repos","events_url":"https://api.github.com/users/JohnnyDevNull/events{/privacy}","received_events_url":"https://api.github.com/users/JohnnyDevNull/received_events","type":"User","site_admin":false},"created_at":"2016-02-06T14:18:38Z","updated_at":"2016-02-06T14:18:38Z","body":"I think i have found the problem. I have to add the meshes to an extra array. An intersectObjects over the scene.children don't work, because there are other objects in there with the meshes.\r\n\r\nSo when i give the intersectObjects( mesh[] ) an mesh array than it works.\r\n\r\n"}}