Hi,
I'm fairly new to Box2dWeb, but have been really enjoying learning and playing around with it.
In my "game" I want to construct the ground using an edge chain. Looking through the source, the only object that references chains is the b2EdgeChainDef, however, I don't know its correct usage and Google didn't turn up anything useful.
I've tried something like the following, but it doesn't work because b2EdgeChainDef is not a descendant of b2Shape:
fixDef.shape = new b2EdgeChainDef;
fixDef.shape.isALoop = false;
fixDef.shape.vertexCount = 6;
fixDef.shape.vertices = [
new b2Vec2(-CAR_WIDTH/SCALE,0),
new b2Vec2(180/SCALE,0),
new b2Vec2(220/SCALE,50/SCALE),
new b2Vec2(420/SCALE,50/SCALE),
new b2Vec2(460/SCALE,0),
new b2Vec2((canvWidth + CAR_WIDTH / SCALE),0)
];
gWorld.CreateBody(bodyDef).CreateFixture(fixDef);
I've also had a look at the DrawDebugData, and I'm not sure I see support for edge chains in there (but maybe I just missed something).
Any help would be appreciated.
Thanks,
Eugene