var Shape1 = new b2BoxDef();
Shape1.extents.Set(10, 10);
Shape1.density = 1;
Shape1.restitution = .3;
Shape1.friction = 1;
var BodyDef1 = new b2BodyDef();
BodyDef1.position.Set(950, 450);
BodyDef1.AddShape(Shape1);
Body1 = world.CreateBody(BodyDef1);
var jointDefRevolute = new b2RevoluteJointDef();
jointDefRevolute.anchorPoint.Set(950, 450);
jointDefRevolute.body1 =world.GetGroundBody();
jointDefRevolute.body2 = Body1;
var jointRevolute= world.CreateJoint(jointDefRevolute);
var Shape2 = new b2BoxDef();
Shape2.extents.Set(100, 10);
Shape2.density = 1;
Shape2.restitution = .3;
Shape2.friction = 1;
var BodyDef2 = new b2BodyDef();
BodyDef2.position.Set(950, 530);
BodyDef2.AddShape(Shape2);
Body2 = world.CreateBody(BodyDef2);
var jointDefPrismatic = new b2PrismaticJointDef();
jointDefPrismatic.anchorPoint.Set(950, 565);
jointDefPrismatic.axis.Set(1,0);
jointDefPrismatic.body1 =world.GetGroundBody();
jointDefPrismatic.body2 =Body2;
var jointPrismatic= world.CreateJoint(jointDefPrismatic);
var jointDefGear = new b2GearJointDef();
jointDefGear.body1=Body1;
jointDefGear.body2=Body2;
jointDefGear.joint1=jointRevolute;
jointDefGear.joint2=jointPrismatic;
var jointGear=world.CreateJoint(jointDefGear);
jointGear.m_ratio=1;