Revolute joints force two bodies to be pinned in a common anchor point, leaving only a single degree of freedom: the rotation around the anchor point. One of the most common uses of revolute joints is the creation of wheels and cogs.
We will create wheels later when we build the siege machine. At the moment, I just want to add another box to our script and pin it to the ground body to make you see how to interact with revolute joints. We need to make only some changes in the Main
function:
public function Main() { world=new b2World(new b2Vec2(0,9.81),true); debugDraw(); var bodyDef:b2BodyDef=new b2BodyDef(); bodyDef.position.Set(320/worldScale,470/worldScale); var polygonShape:b2PolygonShape=new b2PolygonShape(); polygonShape.SetAsBox(320/worldScale,10/worldScale); var fixtureDef:b2FixtureDef=new b2FixtureDef(); fixtureDef.shape=polygonShape; var groundBody:b2Body=world.CreateBody(bodyDef); groundBody.CreateFixture(fixtureDef...