Hi!
When I watched the video I immediatetly thought that there also must be some integrated functionality in Unity to convert screen coordinates to world coordinates.
And after a very quick research I found out that there is indeed a built-in functionality.
I used
float mousePosInUnits = Camera.main.ScreenToWorldPoint(Input.mousePosition).x;
and this does the trick.
Why are you using an explicit formula here?