Raycaster interceptor returning hits for invisible faces

I have an Mesh (with cone and or cylinder geometry) object that has 2 materials used for different faces where one has visible:false set.

My raycaster intersector is still selecting the invisibe/transparaent faces that have the visible set to false (of course the objects visible property is still true).

Shouldn’t the raycater respect the visible-ness of the material of the face?

Being able to raycast to invisible objects and faces is actually really useful. Think hotspots for example. You could encapture a whole group of other objects using 1 larger invisible object.

See this example
Hover over, and nearby the animated model.

With the array returned by the THREE.raycaster intersectObjects method,
see https://threejs.org/docs/#api/en/core/Raycaster.intersectObjects
you can check whether the object or face detected is actually visible or not, and whether you want to act on it.

1 Like

Yeah I was expecting the default behaviour would be what I expected but I didn’t think about the cases where invisible things need to be considered. OK will add visibility tests to my click handler.