What the pulley joint does is simple, you have two b2Body (let’s say body1 and body2) and two anchor points. When you pull down one body1 body2 goes up, when you pull down body2 body1 goes up. How you pull them down or move them is really up to you. Add a b2MouseJoint or increase the weight of one b2Body by placing other b2Body in it, or increase the mass or whatever other system you can think about.
In our following example we try to move up our buggy (the keyboard control are turned off this time) by increasing the weight of the b2Body on the left. We increase or decrease its weight by clicking on the green arrows in the middle. When the b2Body weight starts to be bigger than the car weight and the platform weight together, the buggy starts to move up.

Relevant code:

``var pulleydef:b2PulleyJointDef = new b2PulleyJointDef();var bodyoneanchor:b2Vec2 = new b2Vec2(100 / SCALE, 150  / SCALE);var bodytwoanchor:b2Vec2 = new b2Vec2(400 / SCALE,  150 / SCALE);pulleydef.Initialize(counterweight, support, bodyoneanchor, bodytwoanchor, counterweight.GetWorldCenter(), support.GetWorldCenter(), 1);world.CreateJoint(pulleydef as b2JointDef);``

The first b2Vec2 defines the first anchor point for the pulley, the second b2Vec2 defines the second anchor point for the pulley. In the initialize method we pass :

. our first b2Body.
. our second b2Body.
. the first pulley anchor point.
. the second pulley anchor point.
. where to attach the pulley on the first b2Body (we attach to the center with counterweight.GetWorldCenter()).
. where to attach the pulley on the second b2Body.
. finally a scale value used to multiply the value generated by the action of the first b2Body.

For example with a value of 2 the second b2Body will move twice as fast. You could also specify a max length for the first and second b2Body but I’ll leave that to you to experiment with. Now let’s discover the last joint in this overview, the b2GearJoint .