- Home /
How far do the axis go?
What is the maximum possible x position an object can have?
Is this also the maximum for all the other axis?
Answer by Mattivc · Jul 10, 2012 at 12:40 PM
As far as i know the position of objects are stored as floats. Meaning that technically the maximum value for any of the axis is about ±1.5 10^45 to ±3.4 10^38 (http://msdn.microsoft.com/en-us/library/b1e65aza%28v=vs.71%29)
However because of the inaccuracy of floating points it is inadvisable to go above 5-6 digits numbers when dealing with 3D positions.
The Unity grid is 100.000 units, that is probably a good value to stay under. If you find yourself hitting this value you should rethink your implementation, and scale things down.
So short answer. Stay within -50.000 and 50.000 on all axis and you will be fine.
Agreed - just one thing - scaling can be an issue when dealing with physics so be very careful, in general PhysX can seem to behave strangely when dealing with unrealistic sizes.
This is also correct. If you want the physics to be as realistic as possible then: 1 Unity unit = 1 $$anonymous$$eter
If you scale the world, make sure you scale the gravity and masses the same way and you shall be fine.
A 4 unit high male should move double as fast as usual to the ground when falling from a double sized tower to make it look as if nothing was scaled.
Don't forget there are more physical parameters like "Drag",
"Sleep Velocity", "$$anonymous$$in Penetration For Penalty", ...
It's better to stick with 1u == 1m
This is otherwise correct but I don't think scaling will fix anything other than unity complaining about too large position values. By scaling everything down the precision needed to represent vertex positions etc. will also increase because objects are smaller. That means scaling the world doesn't actually give better precision relative to the world size (which I think is what matters). In general keeping objects close to the center and moving the world instead of the player (for example move everything closer to origin when certain distance is reached) are good ways to approach this problem.
Yes, this is correct. What does help is using a floating origin approach and stay close to the origin as smaller values have more precision.
For games which want to model the vast distances of space, there are other techniques like an infinite far clipping plane. Here precision still falls off quickly with distance and the depth buffer degrades even faster with distance. However it allows you to draw huge distant objects and have them still sorted somewhat correctly.
Another approach for simulating space is projecting large distant objects / planets / stars into the view frustum and apply the correct parallax so it appears at the right position, even though it's actually much closer.
Though having the camera close or at the origin is one of the most important techniques.
Your answer
Follow this Question
Related Questions
Change position of camera on scene load? 1 Answer
Find Distance on Single, Relative Axis? 1 Answer
How do I make one transform rotation the same as anothers? 2 Answers
JS Move object over time 1 Answer
Vector 3 - move on only one axis 0 Answers