Hello, I tried to create a weld joint, but the bodies behaved as if there was no joint at all.
When I try to create a revolute joint, the bodies behave as if the joint is behaving as it should.
These pieces of code are both written in the same place. (One commented out when I'm trying the other, don't worry.)
How can I get the weld joint to work?
EDIT: Okay, found that it was because the damping ratio and frequency were not set. This is not mentioned in the manual, so I suggest adding that.
Code:
b2WeldJointDef jointDef;
jointDef.bodyA = body;
jointDef.bodyB = owner->body;
jointDef.localAnchorA.Set(0,0);
jointDef.localAnchorB.Set(0,0);
physics_world.CreateJoint(&jointDef);
jointDef.bodyA = body;
jointDef.bodyB = owner->body;
jointDef.localAnchorA.Set(0,0);
jointDef.localAnchorB.Set(0,0);
physics_world.CreateJoint(&jointDef);
When I try to create a revolute joint, the bodies behave as if the joint is behaving as it should.
Code:
b2RevoluteJointDef jointDef;
jointDef.bodyA = body;
jointDef.bodyB = owner->body;
jointDef.localAnchorB.Set(x,y);
jointDef.localAnchorA.Set(0.0f,0.0f);
physics_world.CreateJoint(&jointDef);
jointDef.bodyA = body;
jointDef.bodyB = owner->body;
jointDef.localAnchorB.Set(x,y);
jointDef.localAnchorA.Set(0.0f,0.0f);
physics_world.CreateJoint(&jointDef);
These pieces of code are both written in the same place. (One commented out when I'm trying the other, don't worry.)
How can I get the weld joint to work?
EDIT: Okay, found that it was because the damping ratio and frequency were not set. This is not mentioned in the manual, so I suggest adding that.