public void RebuildMatrix() { var position = transform.TransformPoint(Center); var rotation = transform.rotation; var scale = transform.lossyScale; scale.x = scale.y = scale.z = Mathf.Max(Mathf.Max(scale.x, scale.y), scale.z); VA_Helper.MatrixTrs(position, rotation, scale, ref cachedMatrix); //return VA_Helper.TranslationMatrix(position) * VA_Helper.RotationMatrix(rotation) * VA_Helper.ScalingMatrix(scale); }
public void RebuildMatrix() { var position = transform.TransformPoint(Center); var rotation = transform.rotation; var scale = transform.lossyScale; switch (Direction) { case 0: rotation *= RotationX; break; case 1: rotation *= RotationY; break; case 2: rotation *= RotationZ; break; } scale.x = scale.y = scale.z = Mathf.Max(scale.x, scale.z); VA_Helper.MatrixTrs(position, rotation, scale, ref cachedMatrix); //matrix = VA_Helper.TranslationMatrix(position) * VA_Helper.RotationMatrix(rotation) * matrix * VA_Helper.ScalingMatrix(scale); }