Transform controls on a specific layer

Hello, I’m attempting to set transform controls to a specific layer, however, it seems that the controls are always set to layer 2? Attempting to toggle the layer does not change visibility of the controls in multiple renderers. If this is the intended functionality, is there any workaround to implement layer visibility for these controls?

Here is an example fiddle: https://jsfiddle.net/notchris/krwnxt9j/

Thank you,

Chris

Update: Sadly, after traversing the controls and updating the layers, their mask changes to 32 and the controls no longer receive input. Not sure how to fix this.

Here is an example: JSFIDDLE

Original:
I solved this issue by traversing through the control object, setting each child object layer to an unused layer.

controls.traverse(( node ) => { node.layers.set( 7 ); } );

This preserved the mesh and hid the controls on the desired render.

Solved here: https://github.com/mrdoob/three.js/pull/11312#issuecomment-597796298

Right now, a custom modification of TransformControls is required. If this becomes a frequent requested feature, one can consider to make the internal raycaster public.

Hi,
I have small update for 2022. The problem is, that internal Raycaster have diffrent layer set so, after traverse object you see controls but raycaster stop working. You can update layers of raycaster very easy, because there is getter for raycaster.
Code for change layer.

 setLayer(channel: number): void {
        this.transformControls.traverse((object) => object.layers.set(channel));
        this.transformControls.getRaycaster().layers.set(channel);
 }
1 Like