b2Body* foundation =[self createStaticBodyAtLocation:CGPointMake(15, 15) withSize:CGSizeMake(35, 35)];
b2Body* beam=[self createDynamicBodyAtLocation:CGPointMake(105, 35) withSize:CGSizeMake(150, 10)];
b2RevoluteJointDef revoluteJointDef;
revoluteJointDef.Initialize(foundation, beam, b2Vec2(30.0/PTM_RATIO,30.0/PTM_RATIO));
_world->CreateJoint(&revoluteJointDef);
The above code creates a static and a dynamic body and then joins them with a revolutejoint. Here's what I get:
Then I add the following lines to add another body, which is a static circle and then join the circle and the previously added bar on the other end of the bar.
b2Body *jointBall=[self createCircleAtLocation:CGPointMake(160, 135)];
revoluteJointDef.Initialize(jointBall, beam, b2Vec2(100.0/PTM_RATIO,10.0/PTM_RATIO));
_world->CreateJoint(&revoluteJointDef);
But here's what I get:
After adding the circle, I can't move the bar. It's fixed. But I'd expect it to join to the circle. I've tried to change the anchor point to different positions but it doesn't help. What am I missing? Maybe it is not possible to join a dynamic body to more than one static bodies.