I just upgraded my project to MG 3.7 and got an error for Matrix.Scale.
Why was that removed? And is there a less ugly way of getting Matrix.Scale than:
var scale = Vector3.One;
var rotation = Quaternion.Identity;
var translate = Vector3.One;
matrix.Decompose(out scale, out rotation, out translate);
This seems really wird considering I only need scale here.
The getter functions on them were incorrect in most contexts.
The setter function on them were improper in most cases.
Essentially the behavior varied on how they were used as even the setter was improper in a general sense, as it didn’t set m44 to 1 in the scalar which in most cases a scale matrix should do.
So this was a case of if your going to break it break it all the way.
You can create extension methods to the matrix class if you need them with clearly defined functionally.
// untested should be fine
public static class Extensions
{
public static Matrix CreateScale(this Matrix m, float x, float y, float z)
{
var m = Matrix.Identity;
m.M11 = x;
m.M22 = y;
m.M33 = z;
m.M44 = 1f;
return m;
}
}