I'm rehearsing on Box2D revolute joints. Everything's going pretty well except for one thing. For some reason bodies joined together with revolute joints do not stay sticked, they start getting apart from each other from the app start when I run it on retina device or simulator. On non retina device it works just fine, as expected. Here's the screenshot of the non-retina version:Non-retina

And here's the behavior when I run the same app on retina device/simulator: Retina

I'm taking content scale factor into account.


Ok, I've finally found the reason for the wrong behavior on retina display. The problem arose from the fact that although I was taking care of the content scale factor in the other parts of the program, I was not taking it into account when initializing joint definitions. It used to be like this:


This way the joints did not work properly and bodies were "seesawing" around some other point. After I changed the code to this:


everything worked as it should. Note that the SCALE_FACTOR is a macro I've defined in a header file that simply takes the current device's content scale factor, which is 2 in retina display and 1 in non-retina one.

  • 4
    \$\begingroup\$ You should probably this to just the rendering system so you're not actually changing the positions of things depending on if you're on a retina device or not. \$\endgroup\$ – Tetrad Apr 12 '13 at 4:59
  • \$\begingroup\$ Yes, definitely follow Tedrads advice here. Don't scale your physics, only your graphics! Otherwise you end up with different simulations alltogether (different sizes means different mass, etc.) \$\endgroup\$ – bummzack Aug 10 '13 at 7:17

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.