I am new to Box2D, and I am trying to create some joints. I attempted to implement the following code which I found in the manual:
However, when I cannot to assign the revolute joint (b2RevoluteJoint* joint) to the b2Joint that the myWorld->CreateJoint(&jointDef); call produces.
Can someone show me how to create this joint properly? Apparently, version 2.1.2 differs from the manual.
Thanks for any help you can offer.
Code:
b2RevoluteJointDef jointDef;
jointDef.body1 = myBody1;
jointDef.body2 = myBody2;
jointDef.anchorPoint = myBody1->GetCenterPosition();
b2RevoluteJoint* joint = myWorld->CreateJoint(&jointDef);
//... do stuff ...
myWorld->DestroyJoint(joint);
joint = NULL;
jointDef.body1 = myBody1;
jointDef.body2 = myBody2;
jointDef.anchorPoint = myBody1->GetCenterPosition();
b2RevoluteJoint* joint = myWorld->CreateJoint(&jointDef);
//... do stuff ...
myWorld->DestroyJoint(joint);
joint = NULL;
However, when I cannot to assign the revolute joint (b2RevoluteJoint* joint) to the b2Joint that the myWorld->CreateJoint(&jointDef); call produces.
Can someone show me how to create this joint properly? Apparently, version 2.1.2 differs from the manual.
Thanks for any help you can offer.