problem about mouse-picking-Collection of common programming errors


  • hexacyanide
    three.js picking ray-picking mouse-picking
    Here is my jsfiddle: HereHere is my previous version jsfiddle without implementing picking, if you want to try it from start: HereMy custom geometry in the scene are having multiple materials which I couldn’t pick them. Please help me to resolve this issue. var subset; var meshMaterial, camera, projector = new THREE.Projector(),scene, renderer, container; var width = window.innerWidth,height = window.innerHeight; var mouse = {x: 0,y: 0 }, INTERSECTED;function change() {subset = new Array();init();animate(); } meshMaterial = [ new THREE.MeshLambertMaterial({color: 0xffffff,opacity: 0.6,depthWrite: false,depthTest: false,vertexColors: THREE.VertexColors }), new THREE.MeshLambertMaterial({color: 0xffffff,opacity: 1,depthWrite: false,depthTest: false,vertexColors: THREE.VertexColors })]; // camera = new THREE.CombinedCamera(width / 2, height / 2, 70, 0.1, 1000, -1000, 1000); camera.position.z = 45; scene = new THREE.Scene();function init() {for (var i = 0; i < document.getElementById(‘txtN’).value; i++) {var conegeo = new THREE.Mesh(getGeometry(meshMaterial), new THREE.MeshFaceMaterial(meshMaterial));subset.push(conegeo);conegeo.doubleSided = true;conegeo.overdraw = true;conegeo.position.set(i * (0.5 – Math.random()) * scale, (0.5 – Math.random()) * scale, (0.5 – Math.random(

Originally posted 2013-11-06 03:09:44.