We have an actor which needs to attach itself to polygons (platforms) and later unattach itself. We use the following code to attach the actor to a platform.
How do I now unattach this joint? Then how to I re-attach it later?
Code:
RevoluteJointDef = new b2RevoluteJointDef();
RevoluteJointDef->Initialize(Body, platformAttach->Body, b2Vec2(center.x * SCALE, center.y * SCALE));
RevoluteJointDef->collideConnected = false;
RevoluteJointDef->maxMotorTorque = 50.0f;
RevoluteJointDef->motorSpeed = 0.0f;
RevoluteJointDef->enableMotor = true;
Joint = g_world->CreateJoint(RevoluteJointDef);
RevoluteJointDef->Initialize(Body, platformAttach->Body, b2Vec2(center.x * SCALE, center.y * SCALE));
RevoluteJointDef->collideConnected = false;
RevoluteJointDef->maxMotorTorque = 50.0f;
RevoluteJointDef->motorSpeed = 0.0f;
RevoluteJointDef->enableMotor = true;
Joint = g_world->CreateJoint(RevoluteJointDef);
How do I now unattach this joint? Then how to I re-attach it later?