I've tried to use the documentation and I've used many tutorials and I can't get two bodies to generate a joint between them. Here is my code:
var swordWeld = new b2DistanceJointDef();
swordWeld.bodyA = this.shape.body;
swordWeld.bodyB = this.sword;
swordWeld.length = 5;
swordWeld.localAnchorA = this.shape.body.GetWorldCenter();
swordWeld.localAnchorB = this.sword.GetWorldCenter();
var joint = world.CreateJoint(swordWeld);
I've also tried the following:
swordWeld.Initialize(this.shape.body, this.sword, this.shape.body.GetWorldCenter());
Why won't the joint appear?
EDIT: I've gotten the joint to appear for one second after loading, then it vanishes...
var swordWeld = new b2DistanceJointDef();
swordWeld.bodyA = this.shape.body;
swordWeld.bodyB = this.sword;
swordWeld.length = 5;
swordWeld.localAnchorA = this.shape.body.GetWorldCenter();
swordWeld.localAnchorB = this.sword.GetWorldCenter();
var joint = world.CreateJoint(swordWeld);
I've also tried the following:
swordWeld.Initialize(this.shape.body, this.sword, this.shape.body.GetWorldCenter());
Why won't the joint appear?
EDIT: I've gotten the joint to appear for one second after loading, then it vanishes...