Reputation: 10551
Some objects which I have placed at a position (-19026.65,58.29961, 1157) from the origin (0,0,0) are rendering with issues, the problem is referred to as spatial Jitter (SJ) ref. Like You can check its detail here or You can see the below image. The objects are rendering with black spots/lines or maybe it is Mesh flickering. (Actually, I can't describe the problem, maybe the picture will help you to understand it)
I have also tried to change the camera near and far clipping but it was useless. Why I am getting this? Maybe my object and camera are far away from the origin.
Remember:
I have a large environment and some of my game objects (where the problem is) are at (-19026.65,58.29961, 1157) position. And I guess this is the problem that Object and Camera are very far from the origin (0,0,0). I found numerous discussions which is given below
I didn't find that what is the minimum or maximum limit to place the Object in unity so that works correctly.
Upvotes: 2
Views: 3952
Reputation: 2099
Since the world origin is a vector 3(0,0,0), the max limit that you can place an object would be 3.402823 × 10^38
since it is a floating point. However, as you are finding, this does not necessarily mean that placing something here will insure it works properly. Your limitation will be bound by what other performance factors your have in your game. If you need to have items placed at this point in the world space,consider building objects at runtime based on where the camera is. This will allow the performance to work at different points from the origin.
Unity suggests: not recommended to go any further than 100,000 units away from the center, the editor will warn you. If you notice in today's gaming world, many games move the world around the player rather than the player around the world.
To quote Dave Newson's site Read Here:
Floating Point Accuracy
Unity allows you to place objects anywhere within the limitations of the float-based coordinate system. The limitation for the X, Y and Z Position Transform is 7 significant digits, with a decimal place anywhere within those 7 digits; in effect you could place an object at 12345.67 or 12.34567, for just two examples.
With this system, the further away from the origin (0.000000 - absolute zero) you get, the more floating-point precision you lose. For example, accepting that one unit (1u) equals one meter (1m), an object at 1.234567 has a floating point accuracy to 6 decimal places (a micrometer), while an object at 76543.21 can only have two decimal places (a centimeter), and is thus less accurate.
The degradation of accuracy as you get further away from the origin becomes an obvious problem when you want to work at a small scale. If you wanted to move an object positioned at 765432.1 by 0.01 (one centimeter), you wouldn't be able to as that level of accuracy doesn't exist that far away from the origin.
This may not seem like a huge problem, but this issue of losing floating point accuracy at greater distances is the reason you start to see things like camera jitter and inaccurate physics when you stray too far from the origin. Most games try to keep things reasonably close to the origin to avoid these problems.
Upvotes: 2