Hello,

`InverseTransformPoint`

is, as the name suggests, the inverse of `TransformPoint`

. As I’ve stated in multiple answers on previous questions, `TransformPoint`

can be described as such:

```
position + rotation*Vector3.Scale(lossyScale, point);
```

Using some logic and some maths we can derive the inverse:

First of course we negate the position, so:

```
point - position
```

Next we must negate the rotation, which is done with the inverse of the rotation Quaternion:

```
(point - position)*Quaternion.Inverse(rotation)
```

And lastly we negate the scaling. Like with scalar multiplication this is done by putting the value “under” 1 (or whatever the proper language is). Since Unity doesn’t support dividing a scalar by a vector we have to do it manually:

```
Vector3.Scale(Vector3(1/lossyScale.x, 1/lossyScale.y, 1/lossyScale.z),
(point - position)*Quaternion.Inverse(rotation));
```

Now that we have an inverse function lets quickly prove that it’s correct.

We know that for any function `f`

:

`f(f'(x)) == x`

and

`f'(f(x)) == x`

Therefore:

```
TransformPoint(InverseTransformPoint(point)) == point
```

So now we can prove our previous function:

```
position + rotation*Vector3.Scale(
lossyScale,
Vector3.Scale(
Vector3(1/lossyScale, 1/lossyScale, 1/lossyScale),
Quaternion.Inverse(rotation)*(point - position)
)
);
//then we can simplify, since the scales cancel out
position + rotation*Quaternion.Inverse(rotation)*(point - position)
//then, since a quaternion times it's inverse is always 1
position - position + point
//which just leaves
point
```

Therefore we have both derived *and* proven the found inverse function of `TransformPoint`

.

Hope this helps,

Benproductions1

PS: I did this on the fly, I don’t actually know the function off by heart