5

Please check the attach image it's a kind of seesaw. But as from image the black bodies have same density. And the horizontal rectangle is attached with the triangle using "Revolute" joint. But still not working any suggestion. in the current situation it's need to be balanced.

enter image description here

Hamdullah shah
  • 804
  • 5
  • 15
  • I think you need to disable the gravity, as your code might be using - (void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration; – iphonic Jun 13 '13 at 12:10
  • No accelerometer is enabled man. and if the gravity is disabled in box2d then how it gonna be look natural. :-) – Hamdullah shah Jun 13 '13 at 12:29

2 Answers2

0

Due to tiny imbalances in the layout caused by the limitations of floating point precision etc, it's highly unlikely that this will ever balance in the middle reliably (just like real life). One thing you could try is to give the beam some angular damping, which would make it less easy to swivel around, so it would slow down quicker and sleep earlier. That might be enough to get it to come to rest without falling to one side or the other.

iforce2d
  • 8,194
  • 3
  • 29
  • 40
  • Any other way to create ? becoz currently it also sleep quickly which i don't want. Then i tried to change the body to not sleep and then the whole b2World too but still not working. – Hamdullah shah Jun 13 '13 at 12:27
  • I doubt it. Unless it can sleep, it will tip to one side. Maybe you could apply a tiny torque to help keep it level. – iforce2d Jun 13 '13 at 13:44
0

I don't think it is the problem of floating point precision. At least it can't appear that fast. As far as I know Box2D resolves contacts (including resting contacts) one by one. It is much faster than simultaneous contact resolve, but less precise at the same time since resolving one contact create impact on the others.

I would try adding a motor with a small maximum torque to your revolute joint and controlling it's speed to balance the system.

Andrew
  • 24,218
  • 13
  • 61
  • 90