Is infinity plausible in Unity?
I don't need to know how to generate infinite levels, I got that. I just need to know how far I can push a single scene. I know the floating point imprecision gets wonky after 19,000 units, but is it possible to use every square inch of that radius without Unity bugging out? I've got levels with a few thousand rooms running just fine, but could I push it further without breaking the engine? Just wondering if I'll need to create new scenes after a while. Thanks for your answers to come!
Hello, do you $$anonymous$$d accepting my answer since it is correct. It really makes me stay motivated to answer these questions.
Answer by AurimasBlazulionis · Sep 11, 2016 at 02:55 PM
That is the point of floating point, it's precision gets lower when you go further. You can go to 19000 at normal scale fine, but if you scale things down to be half the size, you will be able to normally go until you reach 9500. The same if you make things bigger, you will be able to to move well over 19000 and it will look fine. Float after all has only 32 bits of information and you can not really do anything about it.
The solution you are looking for is called origin shifting. Basically you have to move player back to zero coordinates and other objects relatively when you reach some far distances. You can use some external classes like Vector3D to store actual player and other object positions in double precision values.
Not exactly. As I stated in the original question, I know about floating point and its limitations. I needed to know how many gameObjects, active or inactive, can exist in a scene without the engine breaking.
This really isn't applicable anymore, since I would now just delete and regenerate the level according to the player's needs, rather than hiding gameObjects.