我正在尝试学习 Box2d 和 EaselJS。到目前为止,我一直在使用 Box2d 的“调试”形状。如何从 EaselJS 制作自定义形状,启用物理?例如,我有以下代码在屏幕上生成随机球。
var fixDef = new box2d.b2FixtureDef();
fixDef.density = 1;
fixDef.friction = 0.5;
fixDef.restitution = 0.5;
var bodyDef = new box2d.b2BodyDef();
bodyDef.type = box2d.b2Body.b2_dynamicBody;
bodyDef.position.x = Math.random()*800/SCALE;
bodyDef.position.y = 0;
fixDef.shape = new box2d.b2CircleShape(Math.random()*100/SCALE);
world.CreateBody(bodyDef).CreateFixture(fixDef);
如何使用 EaselJS形状对象?
谢谢!