Actionscript:
-
import com.actionsnippet.qbox.*;
-
-
[SWF (backgroundColor=0x000000, width=700, height=600)]
-
-
var sim:QuickBox2D = new QuickBox2D(this);
-
-
sim.setDefault({fillColor:0x113366, fillAlpha:0.8, lineColor:0x3355AA});
-
-
sim.createStageWalls();
-
-
var boxA:QuickObject = sim.addBox({x:10, y:8, width:4, height:0.5, angularDamping:1});
-
var boxB:QuickObject = sim.addBox({x:7, y:8, width:3, height:0.25, angle:-.5, angularDamping:1});
-
var boxC:QuickObject = sim.addBox({x:12, y:2, width:2, height:1});
-
-
var rev:QuickObject = sim.addJoint({type:"revolute", a:boxA.body, b:sim.w.GetGroundBody()});
-
// add a red dot to boxA
-
with (boxA.userData.graphics) lineStyle(), beginFill(0xFF0000), drawCircle(0,0,2);
-
-
var rev2:QuickObject = sim.addJoint({type:"revolute", a:boxB.body, b:sim.w.GetGroundBody()});
-
with (boxB.userData.graphics) lineStyle(), beginFill(0xFF0000), drawCircle(0,0,2);
-
-
sim.start();
-
sim.mouseDrag();
In order to use gear joints (covered in tomorrows post) you'll need to know how to connect to the ground body...
Check out the swf...