In my plugin, I can't get motors to do anything at all 🙁
I even tried copying code directly from the motors and limits example, but it didn't work. Is there anything special you have to do to get motors working apart from using this code when creating the joint?
I even tried copying code directly from the motors and limits example, but it didn't work. Is there anything special you have to do to get motors working apart from using this code when creating the joint?
Code:
DLLCMDC int CreateRevoluteJoint(int ID, int Body1ID, int Body2ID, float x, float y)
{
b2RevoluteJointDef* NewJointDef = new b2RevoluteJointDef();
NewJointDef->body1 = GetBodyPtr(Body1ID);
NewJointDef->body2 = GetBodyPtr(Body2ID);
NewJointDef->anchorPoint.Set(x*Units, y*Units);
NewJointDef->motorSpeed = 1.0f * b2_pi;
NewJointDef->motorTorque = 10000000.0f;
NewJointDef->enableMotor = true;
return GetJointID(GetWorldPtr(ID)->CreateJoint(NewJointDef));
}
{
b2RevoluteJointDef* NewJointDef = new b2RevoluteJointDef();
NewJointDef->body1 = GetBodyPtr(Body1ID);
NewJointDef->body2 = GetBodyPtr(Body2ID);
NewJointDef->anchorPoint.Set(x*Units, y*Units);
NewJointDef->motorSpeed = 1.0f * b2_pi;
NewJointDef->motorTorque = 10000000.0f;
NewJointDef->enableMotor = true;
return GetJointID(GetWorldPtr(ID)->CreateJoint(NewJointDef));
}