Hi,
Im create my box2d physic stuff, but how do I add a standard flash sprite to it, so that I dont have to use debug display?
Im create my box2d physic stuff, but how do I add a standard flash sprite to it, so that I dont have to use debug display?
Code:
var bodyDef:b2BodyDef = new b2BodyDef();
bodyDef.type = b2Body.b2_dynamicBody;
var boxDef:b2PolygonShape = new b2PolygonShape();
fd = new b2FixtureDef();
fd.shape = boxDef;
fd.density = 1.0;
// Override the default friction.
fd.friction = 0.3;
fd.restitution = 1;
boxDef.SetAsBox((Math.random() * 5 + 10) / pixelsPerMeter, (Math.random() * 5 + 10) / pixelsPerMeter);
bodyDef.position.Set((Math.random() * 400 + 120) / pixelsPerMeter, (Math.random() * 150 + 50) / pixelsPerMeter);
bodyDef.angle = Math.random() * Math.PI;
body = world.CreateBody(bodyDef);
body.CreateFixture(fd);
bodyDef.type = b2Body.b2_dynamicBody;
var boxDef:b2PolygonShape = new b2PolygonShape();
fd = new b2FixtureDef();
fd.shape = boxDef;
fd.density = 1.0;
// Override the default friction.
fd.friction = 0.3;
fd.restitution = 1;
boxDef.SetAsBox((Math.random() * 5 + 10) / pixelsPerMeter, (Math.random() * 5 + 10) / pixelsPerMeter);
bodyDef.position.Set((Math.random() * 400 + 120) / pixelsPerMeter, (Math.random() * 150 + 50) / pixelsPerMeter);
bodyDef.angle = Math.random() * Math.PI;
body = world.CreateBody(bodyDef);
body.CreateFixture(fd);