Do I need to use matrix to calculate scale myself somehow?
LocalToWorld just contains a 4x4 float transform matrix. If you know for sure the specific value represents an affine transformation without shear, you could use TransformHelpers.Scale.
public static float3 Scale(in this float4x4 m) =>
new float3(math.length(m.c0.xyz), math.length(m.c1.xyz), math.length(m.c2.xyz));
(source)
There’s also math.decompose which you can use to recover translation / rotation / scale in one go, still requiring an affine transformation without shear:
float4x4 v = ...;
math.decompose(new AffineTransform(v), out float3 translation, out quaternion rotation, out float3 scale);
5 Likes