I am using drei Pivot Controls to allow the user to move an object. I set the initial rotation of the Pivot Controls (rotation={getPivotControlsRotation()}) to be aligned with the box geometry. And everything works great. But the matrices that I get from onDrag are not with respect to the pivot controls. Because of this, if I rotate about the X axis of the Pivot Controls, and extract the rotations as shown below, rotation has values for X, Y, and Z. I need it to be expressed with respect to the Pivot Controls so if i rotate about the pivot controls X axis, Y and Z should be 0?

const rotationMatrix = new Matrix4()
.extractRotation(userTransformationRef.current.local)
const rotation = new Euler().setFromRotationMatrix(rotationMatrix);

Currently struggling with exactly the same problem. When using PivotControls with annotations, each annotation for the rotation arcs seems to show their local rotation, not impacted by the whole rotation matrix. But when I decompose the quaternion from transforrm matrix I get rotation in range of :

0 to -1.4 radians through the first 45 degrees

back from -1.4 to 0 radians through to 90 degrees

0 to 1.4 radians through to 270 degrees
-1.4 to 0 radians to 360 degrees

How could I extract rotation specific to each axis rather than having the rotation matrix?

if you need more features and you know the calculations you can make pull requests, add them. it will be merged quickly. pivot is very complicated math, you won’t find that many people that can alter it. currently it works as the author wanted it to be, his name on github is stingnails.

Thank you for your reply. By any means I do not want to change anything inside the original code of PivotControls, it’s as you mentioned very complex math. I’m just wondering how could I extract proper information about each axis/arc rotation from the transformation matrix returned from the onDrag event. I’m using only X and Y rotations here as I need it only for the sake of creating and updating a section plane.
Below is my visual representation - as you can see I’m getting proper angle value only for some quarters of full angle. In the inputs my values taken from the transformation matrix, directly calculated from quaternion to euler and then degrees. On the gif, rotation values from the PivotControls annotations.