# How do you unscale a matrix?

I’m wondering how to unscale a matrix4? I think I have issues related to mixing rotation matrices with negative scaled objects. Is there a way to unscale a matrix?

I suggest you use Matrix4.decompose() to decompose a given matrix into its position, rotation and scale components. You then set the scale vector to `(1,1,1)` and use Matrix4.compose() to setup a new matrix.

hmm… that doesn’t work…

When object scale is 1,1,1, the decomposition produces:

``````Vector3 {x: 5.000000000000001, y: -2, z: 9.5}
Quaternion {_x: 1.2395200500986857e-33, _y: -8.040613114788646e-17, _z: 6.123234262925839e-17, _w: 1}
Vector3 {x: 1, y: 1, z: 1}
``````

When the object is 1,-1,1 it produces:

``````Vector3 {x: 5.000000000000001, y: -2, z: 9.5}
Quaternion {_x: -8.040613114788646e-17, _y: -1.2395200500986857e-33, _z: 1, _w: -6.123234262925839e-17}
Vector3 {x: -1, y: 1, z: 1}
``````

As you can see, the quaternion is different if the object is scaled negatively…
This creates a double negative effect… Anyway to fix this?

edit: also is strange that the decomposed scale is -1 x instead of -1 y…

Seems like I’ll have to just keep record of the position/quaternion/scale, and don’t use any decomposition of matrices. I should only compose matrices from the object’s position/quaternion/scale values… Let me know if there’s a way to decompose, though, in-case I’m overlooking anything.