In anticipation for my next prototype I started to wonder about scale. It will be a flight simulator in an alien world of sorts. After some tests I quickly realized that naively laying down giant terrains and flying at 1000 units/h might not be a great idea.
I also started the beginnings of a scale transition system, i.e. two cameras rendering two different scenes that represent the same objects at different scales. But that is definitely jumping over the horses (is that an expression?) So I’d like to ask what is the largest numbers one should work with in unity? farthest from the origin and fastest you should move etc. When will I get in trouble with large/small number math or wonky physics?
From what I understand, there was a problem with floating point precision with such large numbers when moving great distances, and yes the physics would go wonky as well.
So what I’ve seen from 3rd party assets (like World Streamer), is essentially you load/unload scenes of terrain tiles (you use 1 terrain tile per scene) and place them in the correct order as you move along. You load in the surrounding terrain tiles around the terrain tile you’re currently in (or over). Then as you move along, you unload the ones over a certain distance away, and load in new ones that are the closest to you.
As you reach too large of values (I don’t know what the threshold is for when Unity can’t handle it anymore), then you essentially “reset” the world origin, so that relative values are once again manageable values. Again, I’m not quite sure how to “reset” the world origin, but I know you can.
With this method you can essentially have a “looping” world that doesn’t end. Or if you can design it correctly, you can have endless terrain.
The biggest problem I’ve seen with this method is simply trying to get the “fps” lag spikes when terrain tiles are loaded/unloaded to be as unnoticeable to the player as possible. It’s not really a huge thing, but sometimes I can really notice the frame drops when new tiles are being loaded in.