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...
3 posts • Page 1 of 1
What do you mean by 'appear'? This code will not draw anything for you. If you are using the debug draw, remember to enable the flag to draw joints.
Who is online
Users browsing this forum: No registered users and 2 guests