# Simulating a small world with Box2D

I would like to use Box2D to simulate a small world, with entity sizes around 1cm (0.01m), some smaller than that.

Box2D's FAQ says twice:

Your moving objects should be between 0.1 - 10 meters.

You should try to get your moving objects in the range 0.1 - 10 meters, with 1 meter being the sweet spot.

I cannot simply multiply all my numbers by 100, because the simulation would become unrealistic (very slow gravity etc).

Is it possible to simulate my world using Box2D?

I'm wondering for instance if it would be possible to scale all the numbers by 100 and transform all the forces and the velocities I apply to the bodies (including gravity) by some factor.

You can decide to measure your game in cm instead of m.

So you'll take a 1.0 unit of distance inside your Box2D world and interpret it as 1.0 cm.

A velocity of 1.0 you'll then interpret as 1.0 $$\\frac {cm} s\$$ = 0.01 $$\\frac m s\$$.

A force of 1.0 you'll interpret as 1.0 $$\\frac {kg \cdot cm} {s^2}\$$ = 0.01 $$\N\$$.

To fix the "gravity too slow" problem, set the gravity to -981 $$\\frac {cm} {s^2}\$$ (ie -9.81 m/s times 100 cm/m).

As long as you're consistent with how you're using and interpreting your numbers, this all works with non-meter scales. too. Meters are just the most conventional/intuitive option.

• Thank you. Won't need to change anything about masses or other values? So, in short, every time I apply a force expressed in m/s (including gravity), impulse or set a velocity, I need to multiply those vectors by 100 to turn them in cm; and need to be aware that all the velocities and positions I read are in cm. That should be it. Correct? I was afraid it would be much more complicated. Sep 19, 2021 at 19:17
• For masses you'll want to either use measured kilogram values for the objects in question (ie. generally very small numbers), or compute a density value in $\frac {kg} {cm^2}$ if using masses generated from collider areas. Sep 19, 2021 at 19:20
• Ok, thank you! So far it seems like it's working! :) Sep 19, 2021 at 19:32