# RevoluteJoint Stop Rotating when Some Physics Body Collide in Andengine + Box2d?

I am making a Game from andengine + box2d in Which i am using RevoluteJoint in that case i am facing some problem that when physics body or Sprite Collide with this Revolute joint body then Revolute body stop rotating then after some time it start rotating I am using below code for this :

this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(movingFace, movingBody, true, true));

final RevoluteJointDef revoluteJointDef = new RevoluteJointDef();
revoluteJointDef.initialize(anchorBody, movingBody, anchorBody.getWorldCenter());
revoluteJointDef.enableMotor = true;
revoluteJointDef.motorSpeed = 100;
revoluteJointDef.maxMotorTorque = 200;

this.mPhysicsWorld.createJoint(revoluteJointDef);

EDIT Here is a screenshot:

• You have to mention that you want the collision to occur or not within triangle bodies you have shown. Commented Jun 19, 2012 at 10:10
• @Siddharth : yes i want collision to occur with triangle bodies but in that case when some other body collide with triangle body then its stop rotating but i want motor never stop if other body collide with triangle body then that body have some reaction Commented Jun 20, 2012 at 6:04

What is happening is that when the triangle hits an object the torque required for the motor to continue exceeds the maxMotorTorque you have set, this effectively stops the motor dead for a while.

The solution is to increase maxMotorTorque high enough so that the motor continues even on collision for your specific game.

Quote from Box2D manual about the joint motor:

A joint motor allows you to specify the joint speed (the time derivative of the angle). The speed can be negative or positive. A motor can have infinite force, but this is usually not desirable. Recall the eternal question:

"What happens when an irresistible force meets an immovable object?"

I can tell you it's not pretty. So you can provide a maximum torque for the joint motor. The joint motor will maintain the specified speed unless the required torque exceeds the specified maximum. When the maximum torque is exceeded, the joint will slow down and can even reverse.

• +1 for this and thanx for ur answer :) @ Daniel Carlsson Commented Jun 20, 2012 at 12:12