- Home /
Unity scaling
Hi, I'm basically trying to understand more how unity scaling and pixel per unit system works. I'd like to understand why to have pixel perfect positioning (so that a single sprite represents an object whose bounds are respectively 1f wide on the x axys and 1f tall on the y) i need to put 32 on pixel per unit in the sprite menu.
I'm not asking for you to explain it, any reference / official guide is much more appreciated, since it seems I cannot find it by myself
Answer by HarshadK · Sep 25, 2014 at 01:12 PM
For understanding this unit to pixel even though there is not much write up material available with the Unity that explains it but the principal actually applies to most of the game engines.
There is actually quite discussion about that over Box2D forums. One of the paragraphs states that:
Box2D physics objects are defined with meters for length and width. Box2D is tuned for a 1x1 meter sized objects. The reason you want PTM (Pixels to Meters) is that you do NOT want to have a 1 to 1 correlation between pixel size and meters size.
For example if you had a car that was 200 pixels long and 50 pixels tall, and you did not use a PTM conversion you would end up creating a Box2D car of 200 meters by 50 meters. That's 656 feet long or about the length of 12 semi trucks. Imagine the force you would have to apply to this car to move it.
In short what you do is you just separate the rendering from the physics calculations.
And the same principle applies to Unity also since all the physics and calculations in Unity are done in its own system which is MKS itself so the same principle applies here.
If you want to understand how this actually works read this article: Pixels
Let us know if this clarifies your queries or anything else is required.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Scaling of GUILayout and GUI elements for android 1 Answer
Android Scaling - Yes, googled it. 0 Answers
Orthographic camera scale Problems? 0 Answers
Unity 4.6 and up have broken my sprite layers. How to fix? 1 Answer