- shape.SetAsBox(aabb.hw, aabb.hh);
- if (density)
- bd.type = Box2D.DYNAMIC_BODY;
- bd.position = new b2Vec2(position[0], position[1]);
- var body = world.CreateBody(bd);
- body.CreateFixture(shape, density || 0);
+ if (center)
+ shape.SetAsBox(aabb.hw, aabb.hh, new b2Vec2(center), 0);
+ else
+ shape.SetAsBox(aabb.hw, aabb.hh);
+ if (density !== undefined)
+ dfn.type = Box2D.DYNAMIC_BODY;
+ dfn.position = new b2Vec2(position[0], position[1]);
+ var body = world.CreateBody(dfn);
+ body.CreateFixture(shape, density || 0.0001);