I’ve been able to decompose a matrix into transform and rotation is easy enough, but I can’t seem to wrap my head around how I could determine whether some of the scale values are positive or negative.
The solution I have at the moment is as follows:
Matrix4x4 t; scale = new Vector3(Mathf.Sqrt(t.m00 * t.m00 + t.m10 * t.m10 + t.m20 * t.m20), Mathf.Sqrt(t.m01 * t.m01 + t.m11 * t.m11 + t.m21 * t.m21), Mathf.Sqrt(t.m02 * t.m02 + t.m12 * t.m12 + t.m22 * t.m22));
All the scale values are output as positive regardless of their original value.
Does anyone know a solution to this problem? Perhaps some code I could look at or a particular formula?