How does TransformControlsPlane work?

I’m trying to adapt TransformControls to scale a box by dragging on the faces (see images).
image
image
image

My attempt kind of works, but with some starting positions, the box scales in the wrong direction, or suddenly scales way faster/slower. I am guessing this is due to my TransformControlsPlane being placed wrong.
My question thus is: how does the TransformControlsPlane get aligned in the TransformControls?
In the source code, I can see that it doesn’t just get oriented towards the camera, but some transformations are applied depending on the current axis. Could someone help me with the reasoning behind this, so I can correctly replicate the behavior?

In case everyone ever runs into an issue trying to adjust TransformControlsPlane, here’s what worked for me:

  • Try to visually debug the plane by making it smaller and visible
  • By thinking it through visually, I noticed that I had to transform the plane to be centered on the face intersection point

By applying this simple tranformation, my face scaling now works :slight_smile: