Author Archives: Zevan

QuickBox2D Contacts Part 3

CLICK HERE TO COPY
Actionscript:

import com.actionsnippet.qbox.*;

import Box2D.Common.Math.*;

 

[SWF(width = 800, height = 600, backgroundColor = 0x222222, frameRate=60)]

 

var sim:QuickBox2D = new QuickBox2D(this, {debug:false});

 

sim.createStageWalls();

 

var cup:QuickObject = sim.addPoly({x:3, y:13, wireframe:false, density:0,

                                   points:[0,0, .5, 0, .5,3,  2,3,  2,0,  2.5,0, 2.5, 3.5, 0, 3.5, 0,0]});

var [...]

Posted in Box2D, QuickBox2D | Tagged , , , , | 19 Comments

QuickBox2D 1.0 Features

Here is a quick list of the new features in QuickBox2D along with links to the docs.
1) The QuickBox2D.STEP event:
A few releases ago, frim (frame rate independent motion) was added to QuickBox2D. However, there was no way to execute calls to b2Body.ApplyImpulse() b2Body.SetLinearVelocity() etc... along with the b2World.Step() method. This meant that you couldn't [...]

Posted in QuickBox2D | Tagged , , , | 1 Comment

QuickBox2D Contacts Part 2

CLICK HERE TO COPY
Actionscript:

import com.actionsnippet.qbox.*;

 

[SWF(width = 800, height = 600, backgroundColor = 0x000000, frameRate=60)]

 

var sim:QuickBox2D = new QuickBox2D(this);

 

sim.createStageWalls();

 

var boxA:QuickObject = sim.addBox({x:3, y:3, width:2, height:2});

var boxB:QuickObject = sim.addBox({x:3, y:6, width:2, height:2});

 

// add a few extra circles to show that there are other contacts

// occuring

for (var i:int = 0; i<10; i++){

    sim.addCircle({x:5 + i, y:4, radius:0.1 [...]

Posted in Box2D, QuickBox2D | Tagged , , , , | 2 Comments

QuickBox2D Contacts Part 1

CLICK HERE TO COPY
Actionscript:

import com.actionsnippet.qbox.*;

import Box2D.Common.Math.*;

 

[SWF(width = 800, height = 600, backgroundColor = 0x000000, frameRate=60)]

 

var sim:QuickBox2D = new QuickBox2D(this, {debug:false, frim:true});

 

sim.createStageWalls();

 

var boxA:QuickObject = sim.addBox({x:3, y:3, width:2, height:2, fillColor:0xFF0000});

var boxB:QuickObject = sim.addBox({x:3, y:6, width:2, height:2, fillColor:0xFF0000});

 

sim.start();

sim.mouseDrag();

 

// when boxA touches boxB a circle QuickObject is created

var contacts:QuickContacts = sim.addContactListener();

// listen for contact points being added

contacts.addEventListener(QuickContacts.ADD, onAdd);

function onAdd(evt:Event):void{

  [...]

Posted in Box2D, QuickBox2D | Tagged , , , , | 10 Comments