I noticed that since v72, the raycaster ignore clicks on objects that are set to visible = false;
I also noticed that some people asked to let the choice to the developer to manage the raycaster to allow clicks on invisible objects as well as visible.
Is there a plan on the roadmap to implement this ?
Thanks
You can do this. Just set the material visibility to false instead of the object visibility.
I can't do this because all my objects share a common material, and I need to show only certain meshes at a given time. If I implement your solution, when I will show the material, it will show all the meshes
Maybe the right solution for this will be to implement layers
in Raycaster
.
You should still be able to use THREE.Mesh.prototype.raycast directly on the mesh with visible = false:
// instead of
// var intersects = raycaster.intersectObject( mesh );
var intersects = [];
mesh.raycast( raycaster, intersects );
if( intersects.length > 0 ) { ...
Yep. That too!
Could layers be practically emulated using children of scene? Such as scene.add(layer1)
, scene.add(layer2)
and then raycaster.intersectObjects(layer1.children, true)
, for example?
Closing this issue. #14700 tracks how Raycaster
should handle invisible objects and whether or not it should utilize Layer
.
Most helpful comment
You can do this. Just set the material visibility to false instead of the object visibility.