I load the gltf model in scene and when I raycast the model then sometimes it works and sometime its now work even if I click surrounded the model then it give me the intersect object .So is there any way to handle which give me proper intersect where I click on the model or not give me the intersect value where I click on the scene .Thanks
mouseMove(event)
{
pointer.x = (( event.clientX )/ window.innerWidth ) * 2 - 1;
pointer.y = -(( event.clientY )/ window.innerHeight ) * 2 + 1;
}
pickModel()
{
raycaster.setFromCamera(pointer, camera);
let intersects = raycaster.intersectObjects(scene.children,true);
if (intersects.length>0 && intersects[0].object.name!=''){
console.log(intersects[0].object);
}
}