- Home /
How small can I scale objects?
I'd like to make sure I'm using the right scale for my project since it's stressed out in the manual that it can have a big impact on the physics.
Now I understand that 1unit = 1Meter is the usual scale to go with. That's the usual fps-real-world-scenario I assume.
In my case the 'world' is going to be as big as about a normal sized room (4x4 Meters). But the actual gameplay is going to be very small with physics objects of less then 1cm size interacting with each other. Same for light, they would cover only few centimeters in real world scale. Smaller objects and their components (that are even smaller) are still very detailed meshes though. And they're supposed to act like toy sized objects.
Can the physics/light engine scale down indefinitely? Or should I go with a bigger scale and try to adjust the physics?
Thx
Notice that the 1 unity == 1 meter concept only holds true if you run with the default value of Physics.gravity - all other physics related data operates completely relative. If your simulation does not have any rigidbodies using built in gravity (you could quite easily roll your own), you needn't care about Physics.gravity and scale is just what you define it to be.
The situation in my project is not that everything is just taking place at very small scale. I have a normal sized scenario (a room with furniture, lights and physics) and the player (and his tools, vehicles) is only toy-sized. That way I constantly have to work at normal scale and than again at very small scale. And the physics have to work for both sizes... I now think that I'll try to find a scale that works more or less for both sizes in the editor and I try to adjust the physics to the normal size. I guess this (very unusual) situation is just not what unity is made for but it might work.
Answer by jashan · Dec 18, 2009 at 12:28 PM
My feeling on this would be that this is exactly a case where you want "real world scale" - because you said the objects should behave as one would expect very small objects to behave. You'll probably still have to do some tweaking for the physics to be fun but having the actual scale (centimeters) should certainly help.
Regarding how small you can scale: As Unity deals with floating point values, that shouldn't be a problem. You can basically scale up or down as much as you want. However, I think you may run into precision trouble if you mix large-scale and lower-scale.
One thing you definitely want to be careful with is the near/far clip pane of your cameras (you'll need to adjust that to your scale).
I'll try real-world-scale then, since I've run into a lot of problems with 'player = 2meters' when the player is supposed to behave like a toy. Very small scales are a problem for the editor I can't really use the scene view very well, because the moving steps are way to big to get close to a small object. Can that be adjusted by any chance? Or the other way around: Can the physics engine scale be adjusted so that I can work with normal sizes in the editor?
Answer by TowerOfBricks · Dec 19, 2009 at 10:04 AM
I suggest you just scale your objects so that 1 unit = 1 cm, and that you change the gravity accordingly. The only thing which is scale dependent is the gravity, and in some cases when the scale is really small, floating point accuracy might be a problem. If you use this approach the editor won't mess up.
Thanks for clearing this up. It's a lot easier to work when the size that the most gameplay happens in is more or less the editors intended scale. I haven't tried to apply realistic physics yet but I'll try that out soon. If gravity is the only difference it should work alright though. Thx Jashan and Stone
Answer by Stevan Eidson · Aug 08, 2010 at 02:29 AM
Having gone through this in detail with a pinball game I created, I can tell you that there are certain limitations of the physics engine. The physics in this game still do not work to my satisfaction and I am trying to correct this issue for the third time.
Fortunately, gravity scales linearly, so there are some ways around the limitations on scale by choosing your own scale. For a pinball machine, centimeters or inches would be more natural choices for the scale than say feet or meters for the reason that a previous poster noted. Detecting collisions when the objects are small fractions of a unit is almost impossible to do accurately if the units are large. For example, a pinball is 27mm in diameter, or 0.027m. Trying to determine even a 10% penetration of the pinball (0.0027 m) is highly inaccurate, which is no good for a pinball game. Pinballs going through bumpers are not acceptable. I would have to agree that this problem has to do with floating point precision.
I originally thought to use inches as the scale for the game as that was the scale I modeled the objects at. Using inches, the gravitational constant becomes fairly large (386.2 inches/sec^2) and the physics start to fall apart. I have not received a proper explanation of this anomaly,but even with a simple ball and cube example, it is easy to recreate. An example of this is the pinball just dropping right through the table, which makes the game unplayable. I believe that the physics would work properly if the objects were larger, but the primary object, the pinball is 1.0625 inches in diameter. Obviously, if inches don't work, centimeters definitely will not work as the gravitational constant is larger.
Eventually, I was forced into a compromise that did detect collisions fairly well, and avoided a large gravitational constant. I chose decimeters, which puts the gravitational constant at 98.1 dm/s^2, and avoids small objects in the game. The pinball is 0.27 decimeters in diameter, which works for most collisions, but there are still problems with collision detection. There is another good reason to choose decimeters, and not make up your own units. Since decimeters are 1/10 of a meter, it is easy to do sanity checks on measurements. I hope this is helpful.
Answer by xaddict · Dec 20, 2009 at 04:41 PM
You could also scale everything up so that the characters are 'normal' sized, but the world is huge. This does not affect gameplay, except for gravity/mass which you may have to scale up or down. Try to create the game as if everything were scaled normal and then have the physics and environment give the feel of a huge environment and tiny puppets.
Answer by Chris 6 · Aug 24, 2010 at 04:15 AM
I'm encountering the same problem as Stevan with a similar domain / similar scale (spheres a few centimeters in diameter). The decimeter approach with g = 98.1 seems to work fine...unless the ball is going "too fast." Drop it from 3m and it impacts the plane and stops. Drop it from 4 meters and it goes right on through.
Your answer
Follow this Question
Related Questions
The REAL size of an object. 3 Answers
Change parent then the scale will change ? 1 Answer
Box colliders and negative scales 6 Answers
scaling objects with rigidbodies 2 Answers
Long-distance physics 0 Answers