# Should I calculate in meters or pixels

In my car sim I am doing my calculations in Standard Units, except for the distance which is in pixels. Is this still correct (my guess is no) or should I use Meters ?

If I should use meters what is the best way to go about it? should I just pick a scale 10px = 1m or is there a better way to do this ?

Some additional info: I'm using Unity3D and using its physics engine.

• When you say that 1 meter = 1 pixel, it does not really matter. – Ivan Kuckir Mar 2 '13 at 10:31

A lot of physics engines operate at a scale of 1 unit = 1 meter. Unity isn't any different, as you can see in the manual.

The size of the your GameObject's mesh is much more important than the mass of the Rigidbody. If you find that your Rigidbody is not behaving exactly how you expect - it moves slowly, floats, or doesn't collide correctly - consider adjusting the scale of your mesh asset. Unity's default unit scale is 1 unit = 1 meter, so the scale of your imported mesh is maintained, and applied to physics calculations. For example, a crumbling skyscraper is going to fall apart very differently than a tower made of toy blocks, so objects of different sizes should be modeled to accurate scale.

So 1 unit = 1 meter. Don't use pixels for your physic engine. Your world should be decoupled from the actual rendering output (which is in pixels)

For the best simulation accuracy, you should choose units such that typical numbers are close to 1 in scale; this will ensure your physics' floating-point computations are as accurate as possible. This applies to all numbers — lengths, masses, etc.

So, for games with human-scale objects like cars, 1 = 1 meter is a perfectly fine choice. On the other hand, if you were, for example, simulating a pinball machine, it would be good to scale things so that the ball's radius is 1.

• I don't think this is accurate advice. It's more important to have correct unit sizes (eg. corresponding to the meter scale) in order to have a realistic simulation. Having a pinball at the size of 0.02 units isn't going to make your simulation less accurate. Problems arise when you have objects with really large differences in size though. Eg. a pinball of size 0.02 colliding with objects of size 200000.0. – bummzack Mar 3 '13 at 11:18