# Bodies do not stay sticked together by joint in retina display

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:

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

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:

myRevoluteJointDef.Initialize(body1,body2,b2vec2(10.0,5.0));


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

myRevoluteJointDef.Initialize(body1,body2,b2vec2(10.0/SCALE_FACTOR,5.0/SCALE_FACTOR));


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.

• 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. – Tetrad Apr 12 '13 at 4:59
• 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.) – bummzack Aug 10 '13 at 7:17