While attempting to do a selection of a single point by clicking in a point cloud(~20000 pts) loaded using XYZLoader, the intersectObject(pointCloud) returns all the points in the point cloud, even when I’m clicking outside of the point cloud.
Tried
geometry.boundingBox=null after load, doesnt work.
geometry.computeBoundingSphere(), doesnt work.
I had seen previous issues where most of them had to do with single point selection or points aligned in a line, but this one seems to be different from those.
I’m doing the basic raycasting from docs.
function onClick( event ) {
// calculate mouse position in normalized device coordinates
// (-1 to +1) for both components
mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
raycaster.setFromCamera( mouse, camera );
var intersects = raycaster.intersectObject( scene.children[0] );
for(var i = 0; i < intersects.length; i++){
intersects[ i ].object.material.color.set( 0xff0000 );
}
}