Hey guys.

I created a method in blender importer that retreives the scale from Matrix4f.

Here it is.

[java]

public Vector3f getScale(Matrix4f matrix) {

float scaleX = (float) Math.sqrt(matrix.m00 * matrix.m00 + matrix.m10 * matrix.m10 + matrix.m20 * matrix.m20);

float scaleY = (float) Math.sqrt(matrix.m01 * matrix.m01 + matrix.m11 * matrix.m11 + matrix.m21 * matrix.m21);

float scaleZ = (float) Math.sqrt(matrix.m02 * matrix.m02 + matrix.m12 * matrix.m12 + matrix.m22 * matrix.m22);

return new Vector3f(scaleX, scaleY, scaleZ);

}

[/java]

How do you think about adding it to Matrix4f class ?

I have been using it for a long time and looks like it works correclty

The implementation would look like this:

[java]

public Vector3f toScaleVector() {

Vector3f result = new Vector3f();

this.toScaleVector(result);

return result;

}

public void toScaleVector(Vector3f vector) {

float scaleX = (float) Math.sqrt(m00 * m00 + m10 * m10 + m20 * m20);

float scaleY = (float) Math.sqrt(m01 * m01 + m11 * m11 + m21 * m21);

float scaleZ = (float) Math.sqrt(m02 * m02 + m12 * m12 + m22 * m22);

vector.set(scaleX, scaleY, scaleZ);

}

[/java]