Hello, here's an image showing what I'm trying to achieve:


I know I have to use Joint (I think so)
I think I will use custom body type for the stick of this lever (green colour) with 2 sensors, one on the left side and one on the right (to determine which side its being touched after contact with player's body, so lever will be pushed left or right)
But I have no idea how to prevent this stick from 360 rotation.
Before trying to create this lever, I managed to create 'rotating cross' like this (its rotating constantly)

With this code:
Code:
public static void createCross(TextureRegion boxTextureRegion, TextureRegion crossTextureRegion, PhysicsWorld physicsWorld, Scene scene, float x, float y, int speed)
{
final FixtureDef objectFixtureDef = PhysicsFactory.createFixtureDef(10, 0.2f, 0.5f);
final Sprite anchorFace = new Sprite(x, y, 30, 30, boxTextureRegion);
anchorFace.setCullingEnabled(true);
final Body anchorBody = PhysicsFactory.createBoxBody(physicsWorld, anchorFace, BodyType.StaticBody, objectFixtureDef);
final Sprite movingFace = new Sprite(x-85, y -85, crossTextureRegion);
movingFace.setCullingEnabled(true);
final Body movingBody = Utils.createCrossBody(physicsWorld, movingFace, objectFixtureDef, BodyType.DynamicBody);
movingBody.setUserData("tile");
final Line connectionLine = new Line(x + 30 / 2, y + 30 / 2, x + 30 / 2, y + 30 / 2);
scene.attachChild(connectionLine);
scene.attachChild(anchorFace);
scene.attachChild(movingFace);
physicsWorld.registerPhysicsConnector(new PhysicsConnector(anchorFace, anchorBody, true, true)
{
@Override
public void onUpdate(final float pSecondsElapsed)
{
super.onUpdate(pSecondsElapsed);
final Vector2 movingBodyWorldCenter = movingBody.getWorldCenter();
connectionLine.setPosition(connectionLine.getX1(), connectionLine.getY1(), movingBodyWorldCenter.x * PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT, movingBodyWorldCenter.y * PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT);
}
});
physicsWorld.registerPhysicsConnector(new PhysicsConnector(movingFace, movingBody, true, true));
final RevoluteJointDef revoluteJointDef = new RevoluteJointDef();
revoluteJointDef.initialize(anchorBody, movingBody, anchorBody.getWorldCenter());
revoluteJointDef.enableMotor = true;
revoluteJointDef.motorSpeed = speed;
revoluteJointDef.maxMotorTorque = 200;
physicsWorld.createJoint(revoluteJointDef);
}
(I'm using andengine, so there are additional classes such as Sprite etc)
I'm trying to modify this code to make it act as a lever, but no luck.
Any hints please?