Hello from PerĂº!
I want to create a compound body in box2dWeb, what i need is a maze, this maze can rotate using keyboard. I saw an example of compound bodies in AS3 but i can not find this function: body.SetMassFromShapes().
This is may code:
Code:
....
for (var j=0; j<9; j++) {
for (var i=0; i<9; i++) {
if (maze[j][i]==1) {
console.log("pos i="+i+" j="+j);
var boxDef = new b2FixtureDef();
boxDef.density=1.0;
boxDef.friction=0.5;
boxDef.restitution=0.2;
boxDef.shape = new b2PolygonShape();
boxDef.shape.SetAsOrientedBox(1.5,1.5,new b2Vec2(i, j), 0);
body.CreateFixture(boxDef);
}
}
}
console.log(body);
body.SetMassFromShapes();// ERROR
Can someone help me?
Sorry by my english
