SpriteKit SKPhysicsBody units

What are the units that SpriteKit uses?

Is there a way to get the conversion it is using (pixels to meters)?

If you have used SKPhysicsBody for a game, how did you wrangle the physics to get reasonable behavior? What numeric range did you use?


The documentation states that SI units are used, but its *extremely* clear that this is not the case and some kind of scaling/conversion is happening. (This article http://blog.element84.com/comparing-sprite-kit-physics-to-direct-box2d.html implies its something like 150px<->1m)


The documentation and examples I find online create a world that is sized 1:1 the same as the device size, and set object sizes 1:1 the same as pixels. A 2 kilometer playfield with 150 meter objects flying around it? This is not reasonable.


When I create objects in pixel sizes I get moderately ok behavior (floaty as ****, terrible spring oscillation, but ok). When I create them in reasonable SI units (say, 2 meter sized objects) it all falls apart. Collisions happen before objects overlap (looks a lot like the ~1cm skin box2d adds to objects). Rotations get messed up. Springs behave really weird.


After many hours of experimenting with SKPhysicsBody and googling for answers I am still completely blocked here. I'm hoping someone here can shed light on this mystery!


Thanks!

There is a 150:1 px:m scaling factor. In addition, I notice that directly-applied forces need to be multiplied by about 164 to work accurately. I don't know what needs to be wrangled for springs, etc.

Apple states several times in the documentation that the physics simulation is not deterministic, and that you should find values that work for your application. FWIW, I would not get too hung up on the exact units which are being used. If you want a precise simulation, then you probably need to include your own framework.

SpriteKit SKPhysicsBody units
 
 
Q