[using 2.1a]
I've followed the examples and a tutorial from Emanuel, and something's just not working.
Here's the result:

As you can see, the joints are "connected" but they don't rotate; instead they separate. No good.
Here's the code that I'm using:
So, what simple thing am I overlooking that will make this set of boxes work like a chain? Do you need to know my b2World conditions in order to solve this?
I've followed the examples and a tutorial from Emanuel, and something's just not working.
Here's the result:

As you can see, the joints are "connected" but they don't rotate; instead they separate. No good.
Here's the code that I'm using:
Code:
var fixture:b2Fixture;
var body:b2Body;
var link:b2Body = _body;
var revolute_joint:b2RevoluteJointDef = new b2RevoluteJointDef();
var Y:Number;
var length:Number = Physics.WORLD_SCALE;
var relLength:Number = length / Physics.WORLD_SCALE;
var startY:Number = py + (this.width * 0.45);
md = new b2MassData();
md.mass = 1;
for( var i:int = 0; i < 10; i++ )
{
// rope segment
Y = startY + (i * length);
fixture = Physics.instance.createBox(X, Y, 2, length, b2Body.b2_dynamicBody);
fixture.SetFriction(0.5);
body = fixture.GetBody();
body.SetMassData(md);
// joint
revolute_joint.Initialize( link, body, new b2Vec2( (X + 1) / Physics.WORLD_SCALE, body.GetPosition().y - relLength/2 ) );
Physics.instance.world.CreateJoint( revolute_joint );
// saving the reference of the last placed link
link = body;
_chains.push(body);
}
var body:b2Body;
var link:b2Body = _body;
var revolute_joint:b2RevoluteJointDef = new b2RevoluteJointDef();
var Y:Number;
var length:Number = Physics.WORLD_SCALE;
var relLength:Number = length / Physics.WORLD_SCALE;
var startY:Number = py + (this.width * 0.45);
md = new b2MassData();
md.mass = 1;
for( var i:int = 0; i < 10; i++ )
{
// rope segment
Y = startY + (i * length);
fixture = Physics.instance.createBox(X, Y, 2, length, b2Body.b2_dynamicBody);
fixture.SetFriction(0.5);
body = fixture.GetBody();
body.SetMassData(md);
// joint
revolute_joint.Initialize( link, body, new b2Vec2( (X + 1) / Physics.WORLD_SCALE, body.GetPosition().y - relLength/2 ) );
Physics.instance.world.CreateJoint( revolute_joint );
// saving the reference of the last placed link
link = body;
_chains.push(body);
}
So, what simple thing am I overlooking that will make this set of boxes work like a chain? Do you need to know my b2World conditions in order to solve this?