Sup community,
I'm trying to learn box2d but am stuck on what should be easy. I'm defining a revolute joint with motor etc, and am later, upon ccTouchesBegan, trying to increase the motor speed.
In the .h I have:
b2RevoluteJointDef jd2;
b2Joint *rev2_joint;
In the init I have:
b2Vec2 anchor2;
anchor2.Set(bd2.position.x, bd2.position.y);//bd2 is the position of a body
jd2.Initialize(swingarm, rwheel, anchor2);
jd2.collideConnected = false;
jd2.motorSpeed = -10.0f;
jd2.maxMotorTorque = 100000.0f;
jd2.enableMotor = true;
rev2_joint = _world -> CreateJoint(&jd2);
Upon run I get a nice turning revolute joint, at speed -10. Now I want to change this speed, like the backwheel on a car upon acceleration. I'm finding myself unable to update it. The following
rev2_joint->SetMotorSpeed = -100.0f;//didn't work - error says request for member motorSpeed is not in b2Joint
rev2_joint.motorSpeed = -10000.0f;//didn't work - error says request for member motorSpeed is not in b2Joint
Any suggestions? Am I defining the joints all wrong?
Thanks