========
SOLVED
========
Near Clipping on Camera was set to 0.1
Changing it to any other value (1, 10, 100) fixed this.
Upon posting this problem, within minutes the solution came to me.
Leaving this here for future reference.
Thank you!
I am using S̶c̶r̶e̶e̶n̶T̶o̶W̶o̶r̶l̶d̶P̶o̶i̶n̶t̶ ScreenToRayPoint to convert from the player’s mouse cursor to world coordinates in a flat 3D world.
Asking THIS QUESTION and I eventually found out (assumed) it seems to be a floating point limitation. However, this is a pretty big problem when it really shouldn’t be: it begins to become inaccurate very quickly. Almost immediately actually: in the 3-4 digit transform range.
A Short Synopsis
- When the Player (Camera) is at Transform 0,0,0 all is well. Very accurate ScreenToWorldPoint().
The slightest change in mouse position will result in a change in world position. #Winning - When far out, such as when the Player/Camera is at Transform.position.x = 30,000, it is completely unusable.
Here is an example where the world position of the player/camera is at
Vector3 (-30000, 0, 0)

The Y (0) is perfectly smooth.
- However the X (-30,000) is very inaccurate.
Moving the mouse doesn’t even move the object, until it leaps in a big chunk. - This problem begins to show up almost immediately though. Quick testing shows it to be very problematic at just -4000 position.
- However it seems much better at -3000 (which is also 4 digits) so I am wondering if I was wrong in assuming this is about floating point precision transforms? Although the math could just be complex enough that it begins to become inaccurate at higher numbers (but same digits).
I am raycasting to the terrain (flat ground; square colliders).
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, 10000, LayerMask.GetMask("Ground")))
{
myCursorObject.transform.position = hit.point;
}
The object (green circle) is a 3D object located in 3D worldspace.
The mouse cursor is obviously in 2D screenspace.
The camera is perspective. Vector3 (0,3450,-1750) relative to the player; rotation (60); Near 0.1; Far 999999
This forces me to keep the Player/Camera at 0,0,0 & move the world around them. (requiring a lot of extra work).
I was hoping that I’m just missing something obvious, or could get help in creating a better method than ScreenPointToRay? The math involved isn’t the easiest thing for me to understand.
If I am correct in my understanding, then I am surprised this isn’t a bigger problem (more readily found through googling). Hopefully though I am just doing something obviously wrong.


