Disable DragControls hoveron listener for hidden objects

Is there a way to disable DragControl’s hoveron listener for meshes/objects that are hidden?

You can solve this issue with layers. Meaning visible objects are on layer 0 (default) and hidden on layer 1. DragControls internally uses an instance of Raycaster which evaluates layers for its intersection test. Objects in layer 1 will not be tested.

You will see in the following live demo that it’s not even necessary to configure Object3D.visible anymore (since camera’s only see objects on layer 0 by default). Just use the following line of code:

object.layers.set( 1 );


1 Like

That works great. Thank you.