Search code examples
box2dphysicsunits-of-measurementphysics-enginefarseer

Which Box2D-like physics engine parameters need pixel conversion?


The official guide does not have any useful details on the matter:

http://www.box2d.org/manual.html

Position is an obvious one. What about velocity? Density? Anything else?

Update: the context is wrapping/interfacing a physics engine to make it more usable. E.g. units of measure in the game editor should be consistent.


Solution

  • Every thing you specify in physics will have units. If you decide that physics is working in meters and your editor works in pixels then you will need to convert everything that has meters in its units. It is probably easiest to just write them all out.

    • position: m
    • velocity: m/s
    • acceleration: m/s/s
    • density: kg/m/m/m

    All of those contain meters, so all of those will need converting. Beware of hidden ones:

    • force: N
    • F = ma => N = kg m/s/s

    So if you want to specify force in a meaningful way instead of just an arbitrary number that people tweak, force needs converting because it is implicitly measured using meters ...