I would like to make a scene where there is a "pendulum" that oscillates continuously, no stop. I have uploaded an image for better clarity. So i try to use Box2D joints. For example:
RevoluteJointDef revDef = new RevoluteJointDef();
revDef.initialize(ball, box, ball.getWorldCenter());
revDef.lowerAngle = 0 * MathUtils.degreesToRadians;
revDef.upperAngle = 180 * MathUtils.degreesToRadians;
revDef.enableLimit = true;
revDef.maxMotorTorque = 10.0f;
revDef.motorSpeed = 2.0f;
revDef.enableMotor = true;
revoluteJoint = (RevoluteJoint)world.createJoint(revDef);
But it doesn't work. If i comment limits and motor lines i obtain the same result that i obtain when these lines are uncommented. Although motor is enabled, it seems not work.
P.S. The motor must stop when the user releases the box by press a button. So the box falls to the ground due to the force of gravity.
Can someone help me? Thanks!!