- Home /
Unity Scene Dimensions
Hi there!
I'm going to begin a project which involves the production of one space RTS (similar in concept to Nexus: The Jupiter Incident) and at this moment I'm choosing the game engine in which I want to produce it.
I am considering sticking with Unity (which I'm already familiarized with), however there's one doubt I've. Is Unity capable of handling vast 3D space scenes, massive worlds, alongside with huge mile long ships, while trying to maintain a 1:1 scale?
Thanks in advance for your answers.
João Borrego
Answer by Bunny83 · Aug 12, 2012 at 01:06 PM
It depends on your implementation. Generally since coordinates are stored as float values the range is between -infinity and +infinity. However the further you go away from center the worst the precision get. Floating point means that you have a fix amount of digits, but you can specify where the "decimal point"(actually the binary point ;)) is.
Just to give an overview of the concept how a float works:
Just say we have 10 digits and another 2 digit number to specify the exponent (10^e)
N = 9000000001 e = 00 --> 0.N * 10^0 --> 0.9 * 1 --> 0.9000000001 // 10 digits behind decimal point
N = 9000000001 e = 01 --> 0.N * 10^1 --> 0.9 * 10 --> 9.0000000010 // 9 digits behind decimal point
N = 9000000001 e = 08 --> 0.N * 10^8 --> 0.9 * 100000000 --> 90000000.1 // 1 digit behind decimal point
So the greater the nubers get the worst is the precision (the smallest step possible). This problem have all engines when you work with a linear world space. That's why such games are usually segmented into smaller sections. for example 1000x1000x1000 (so in each axis between -500 and 500). When ever you reach the border, the coordinates get shiftedto the other side in the new section / region.
Thanks for the answer, however I must ask, in practice, how would that affect movements, physics simulations, collisions and static objects?
Well, usually you would hold 4 sections in memory. The best way is to have all static stuff in one gameobject for each region / section. You just shift the origin. For example, each section has it's pivot locally in the center so it represents 0,0,0. You just load all neighbor sections depending on the quadrant you're in.
-/+ +/+ -/- +/-Whenever you cross the border of a section, for example at +500 / +100 you just shift everything on the x - axis by -1000. So your new position in worldspace is -500 / 100. But your no longer in section 0/0 now you are in 1/0.
It's also possible to shif only by half section size. This would prevent ping pong switches when you move along a section boarder. Since you shift only by 500, the section border you just crossed (at 500) becomes the center. The switch back would happen at -500
Physics and everything else shouldn't cause any problems since directions stay the same and even relative distances stay the same.
It can be a bit tricky, but you need a dynamic loading concept anyway ;)
I was asking more about what would happen if for example, I had two ships, each with 300 meters in lenght, fighting at extreme long range (like 100 kms apart (unity distance)). Would the physics engine, the renderer or the collision detection suffer from those?
However that's one idea I might consider :P
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Spaceship flying! 1 Answer
Scenario connection Problem 0 Answers
How to make a Homeworld Style Camera. 3 Answers
Ship movement in space-based RTS 0 Answers