Hello every one, I’m working on a project where I use a transformation matrix (translation, rotation and scale) to edit the vertices of a mesh. I also group vertices into parent child relationships. There are times where I need to go from a local space to a parent space so I usually use the inverse of my matrix to do that. This works most of the time except when I set the scale to 0 for x, y, or z then the inverse is always a zero matrix. Here is what I mean:

```
parentScale = Vector3.one;
// Create a transformation matrix for parent
Matrix4x4 M = Matrix4x4.TRS(parentTranslation, parentRotation, parentScale);
// Convert local point to parent point
Vector3 parentPoint = M.MultiplyPoint3x4(localPoint);
// Convert parent point back to local point
Vector3 originalPoint = M.inverse.MultiplyPoint3x4(parentPoint);
```

Does not work:

```
parentScale = new Vector3(1,1,0);
// Create a transformation matrix for parent
Matrix4x4 M = Matrix4x4.TRS(parentTranslation, parentRotation, parentScale);
// Convert local point to parent point
Vector3 parentPoint = M.MultiplyPoint3x4(localPoint);
// Convert parent point back to local point
Vector3 originalPoint = M.inverse.MultiplyPoint3x4(parentPoint);
// originalPoint is always Vector3.Zero
```

I notice that in unity the Transform.worldToLocalMatrix and Transform.localToWorldMatrix don’t have that issue. If you have a gameobjet on the scene, that is not a child of another object, then Transform.worldToLocalMatrix is the inverse of Transform.localToWorldMatrix when you have a non-zero scale. If you set the scale of your game object to zero then Transform.worldToLocalMatrix is not the inverse of Transform.localToWorldMatrix but is not a zero matrix either.

Does anyone know how unity generates Transform.worldToLocalMatrix or Transform.localToWorldMatrix or how to generate an inverse matrix that has zero scale?

Thanks in advance.