Hey,
What is the world space limit for dimensions?
I have been trying to draw some lines using line renderers but it does not show if it bigger than some number.
Here’s the screenshot for the positions:
Gameobject Position:(0.0, 0.0, 0.0)
LineRenderer Center:(13746850.0, 0.0, 20733010.0)
LineRenderer Extents:(418.0, 0.0, 318.8)
But nothing shows up in the editor nor in the runtime.
What is the solution to this? Are there some artificial limitations on line renderer / unity 3d / gpus ?
Thanks.
Positions in the world are always represented with Vector3. The components of Vector3 (x, y, z) are 32-bit floats. There is only so much range and precision that can be represented with 32 bits of information.
According to this the approximate range for a float is ±1.5 × 10^−45 to ±3.4 × 10^38
Which gives you quite a lot of space to work with, but the farther out you go from Zero the precision of the representation in the 32-bits goes down. I’m paraphrasing and trying to use language that isn’t overly technical.
Here’s what you should take away from this. You should use floats as close to zero as possible. Treat a value of 1f as 1 meter in world space. 1000 kilometers of distance is only 1,000,000f, well within any tolerable range of precision, and well within anything you’d ever want to render. (If you want to render distant planets or something like that you change the scale, don’t try to render them thousands of kilometers away.
Forgive me if I’m wrong, but I believe the world space does not have a limit.