1 decade ago by eruciform
Something to this effect:
Would allow things like this much easier in a Box2DEntity:
Which would (for example, in the case I was trying to solve) allow you to have all bullets ignore each other in the physics box2d demo.
createBody: function() {
var bodyDef = new b2.BodyDef();
bodyDef.position.Set(
(this.pos.x + this.size.x / 2) * b2.SCALE,
(this.pos.y + this.size.y / 2) * b2.SCALE
);
this.defineBody(bodyDef); // OVERRIDE IF DESIRED
this.body = ig.world.CreateBody(bodyDef);
var shapeDef = new b2.PolygonDef();
shapeDef.SetAsBox(
this.size.x / 2 * b2.SCALE,
this.size.y / 2 * b2.SCALE
);
shapeDef.density = 1;
this.defineShape(shapeDef); // OVERRIDE IF DESIRED
this.body.CreateShape(shapeDef);
this.body.SetMassFromShapes();
},
defineBody: function(bodyDef){},
defineShape: function(shapeDef){},
Would allow things like this much easier in a Box2DEntity:
defineShape: function(shapeDef) {
shapeDef.filter.groupIndex = -1;
},
Which would (for example, in the case I was trying to solve) allow you to have all bullets ignore each other in the physics box2d demo.
