3
\$\begingroup\$

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 ?

thanks in advance.

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

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

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)

|improve this answer|||||
\$\endgroup\$
2
\$\begingroup\$

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.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – bummzack Mar 3 '13 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.