QuickBox2DでaddPoly使ってみた
addPolyに渡す頂点データの最後に余分に一組つけておく必要があるのかな?
/**
* Copyright Akiyah ( http://wonderfl.net/user/Akiyah )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/vLf5
*/
package {
import flash.display.*;
import com.actionsnippet.qbox.*;
import flash.geom.*;
public class FlashTest extends MovieClip {
private const data:Array = [
[0,0, 5,0, 5,1, 0,2],
[0,3, 5,4, 5,1, 0,2],
[0,3, 5,4, 5,5, 0,5],
];
public function FlashTest() {
var sim:QuickBox2D = new QuickBox2D(this);
sim.createStageWalls();
for (var i:int = 0; i < data.length; i++) {
sim.addPoly({x:3, y:2, points:data[i].concat([0,0])});
}
sim.start();
sim.mouseDrag();
}
}
}